美文网首页
重启nginx报错

重启nginx报错

作者: jxc1 | 来源:发表于2019-04-15 19:07 被阅读0次

    今天修改nginx配置文件,配置完了重启nginx一直报错。

    Job for nginx.service failed because the control process exited with error
     code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    

    尝试的方法(前两个不是我这次的问题):
    1.ps -ef | grep nginx
    --显示所有含nginx的进程,然后一一kill掉。

    2.pkill -9 nginx
    --强制停止nginx服务

    3.先试着执行了一下 nginx -t,返回

    nginx: [emerg] BIO_new_file("/etc/nginx/cert/xxx.pem") failed
     (SSL: error:02001002:system library:fopen:No such file or 
    directory:fopen('/etc/nginx/cert/xxx.pem','r') 
    error:2006D080:BIO routines:BIO_new_file:no such file)
    

    看到这个我明白了,更改配置时把.pem和.key的路径改了,配置文件读取时所在的路径是nginx下而不是conf.d下,也就是说,cert这个文件夹要放在nginx下和conf.d平级。
    再执行nginx -t

    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    

    成功了。再执行systemctl restart nginx,就没事了。

    相关文章

      网友评论

          本文标题:重启nginx报错

          本文链接:https://www.haomeiwen.com/subject/cjupwqtx.html