服务内部错误: stderr: 2024/11/05 22:55:59 [emerg] 741#741: no “ssl_certificate” is defined for the “listen … ssl” directive in /usr/local/openresty/nginx/conf/conf.d/1panel.conf:1 nginx: [emerg] no “ssl_certificate” is defined for the “listen … ssl” directive in /usr/local/openresty/nginx/conf/conf.d/1panel.conf:1 nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed
因为没有80端口,所以网页用了888端口,我开启https后在保存配置文件的时候出现了上述错误。
配置文件内容:
server {
listen 888 ssl http2 ;
listen 443 ssl http2 ;
server_name cs.xuan007.top;
index index.php index.html index.htm default.php default.htm default.html;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
access_log /www/sites/cs.xuan007.top/log/access.log main;
error_log /www/sites/cs.xuan007.top/log/error.log;
location ^~ /.well-known/acme-challenge {
allow all;
root /usr/share/nginx/html;
}
root /www/sites/cs.xuan007.top/index;
error_page 404 /404.html;
if ($scheme = http) {
return 301 https://$host$request_uri;
}
ssl_certificate /www/sites/cs.xuan007.top/ssl/fullchain.pem;
ssl_certificate_key /www/sites/cs.xuan007.top/ssl/privkey.pem;
ssl_protocols TLSv1.3 TLSv1.2 TLSv1.1 TLSv1;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL:!EXPORT:!DSS:!DES:!RC4:!3DES:!MD5:!PSK:!KRB5:!SRP:!CAMELLIA:!SEED;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
proxy_set_header X-Forwarded-Proto https;
}