/etc/nginx/nginx.conf 中的无效值 "ssl_certificate"
Invalid value "ssl_certificate" in /etc/nginx/nginx.conf
我刚刚在测试服务器 运行ning Nginx 上上传了一个 SSL 证书。我已将证书和密钥文件路径添加到 nginx.conf 中,但无论我尝试什么,我都会不断收到此错误:
Feb 23 15:01:20 myserver systemd[1]: Starting The nginx HTTP and reverse proxy server...
Feb 23 15:01:21 myserver nginx[1315]: nginx: [emerg] invalid value "ssl_certificate" in /etc/nginx/nginx.conf:67
Feb 23 15:01:21 myserver nginx[1315]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 23 15:01:21 myserver systemd[1]: nginx.service: Control process exited, code=exited status=1
Feb 23 15:01:21 myserver systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 23 15:01:21 myserver systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
我真的,真的不明白:试过“/etc/pki/tls/certs/myserver.pem”或“/etc/pki/tls/certs/myserver.pem”,没有任何改变。文件名、目录我都检查了三遍,我真的一点头绪都没有。
有没有人运行遇到过类似的错误信息?在 Google 甚至这里都找不到太多...
这是我的 nginx.conf 文件中最有趣的部分(第 67 行当然是 ssl_certificate 中的一个):
# Settings for a TLS enabled server.
#
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name myserver;
root /usr/share/nginx/html;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2
ssl_certificate /etc/pki/tls/certs/mymserver.pem;
ssl_certificate_key /etc/pki/tls/private/myserver.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:-MEDIUM:-LOW:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK:!DH;
ssl_prefer_server_ciphers on;
在你的配置文件中
ssl_protocols TLSv1 TLSv1.1 TLSv1.2
缺少终止符 ;
查看文档 here,它说,
The configuration file consists of directives and their parameters. Simple (single‑line) directives each end with a semicolon. [....]
因此,nginx 将其读取为错误语法,并报告错误值。
我刚刚在测试服务器 运行ning Nginx 上上传了一个 SSL 证书。我已将证书和密钥文件路径添加到 nginx.conf 中,但无论我尝试什么,我都会不断收到此错误:
Feb 23 15:01:20 myserver systemd[1]: Starting The nginx HTTP and reverse proxy server...
Feb 23 15:01:21 myserver nginx[1315]: nginx: [emerg] invalid value "ssl_certificate" in /etc/nginx/nginx.conf:67
Feb 23 15:01:21 myserver nginx[1315]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 23 15:01:21 myserver systemd[1]: nginx.service: Control process exited, code=exited status=1
Feb 23 15:01:21 myserver systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 23 15:01:21 myserver systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
我真的,真的不明白:试过“/etc/pki/tls/certs/myserver.pem”或“/etc/pki/tls/certs/myserver.pem”,没有任何改变。文件名、目录我都检查了三遍,我真的一点头绪都没有。
有没有人运行遇到过类似的错误信息?在 Google 甚至这里都找不到太多...
这是我的 nginx.conf 文件中最有趣的部分(第 67 行当然是 ssl_certificate 中的一个):
# Settings for a TLS enabled server.
#
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name myserver;
root /usr/share/nginx/html;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2
ssl_certificate /etc/pki/tls/certs/mymserver.pem;
ssl_certificate_key /etc/pki/tls/private/myserver.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:-MEDIUM:-LOW:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK:!DH;
ssl_prefer_server_ciphers on;
在你的配置文件中
ssl_protocols TLSv1 TLSv1.1 TLSv1.2
缺少终止符 ;
查看文档 here,它说,
The configuration file consists of directives and their parameters. Simple (single‑line) directives each end with a semicolon. [....]
因此,nginx 将其读取为错误语法,并报告错误值。