添加ssl后Nginx不会重启

Slo*_*boy 0 ssl vps nginx ssl-certificate

我添加了一些修改我的 root@mypage:/etc/nginx/sites-available/default

当我这样做时sudo service nginx restart ,服务器会返回此错误:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

如果我运行nginx -t -c /etc/nginx/nginx.conf输出是

Enter PEM pass phrase: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

有人可以告诉我我做错了什么吗?我在这里完全空白

这是root@mypage:/etc/nginx/sites-available/default文件

 server {
    listen 80;
    listen [::]:80 default_server ipv6only=on;

    server_name mypage.com;
    passenger_enabled on;
    rails_env    production;
    root         /home/deploy/mypage/current/public;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
 }

 server {
    listen 443;
    server_name mypage.com;
    passenger_enabled on;
    rails_env    production;
    root         /home/deploy/mypage/current/public;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    ssl                   on;
    ssl_certificate       /etc/ssl/certs/secure.mypage.com.1.2019.chain.crt;
    ssl_certificate_key   /etc/ssl/private/mypage.com.key;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;


    ssl_prefer_server_ciphers     on;
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;

 }
Run Code Online (Sandbox Code Playgroud)

我在安装过程中使用了本指南https://www.youtube.com/watch?v=D2P5cRMi0fQ和本指南http://nginx.org/en/docs/http/configuring_https_servers.html#optimization作为参考。

小智 6

您的私钥已加密,因此您必须在 nginx 启动或解密密钥之前输入密码

mv /etc/ssl/private/mypage.com.key /etc/ssl/private/mypage.com.org.key
openssl rsa -in /etc/ssl/private/mypage.com.org.key -out /etc/ssl/private/mypage.com.key
chmod 400 /etc/ssl/private/*.key
Run Code Online (Sandbox Code Playgroud)