我的NGINX服务器已经停止,它正在生成错误。
我正在使用Ubuntu 16.04,我的应用程序部署在Digital Ocean Server。
当我运行以下colde sudo systemctl start nginx
它给出以下输出:
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
的输出是:
nginx: [emerg] BIO_new_file("/root/bitradiology.chained.crt") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/root/bitradiology.chained.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
我用$ sudo systemctl status nginx
检查了状态
输出是:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-08-21 11:01:51 UTC; 1min 50s ago
Process: 2085 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=2)
Process: 2420 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Main PID: 2462 (code=exited, status=0/SUCCESS)
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 nginx[2420]: nginx: [emerg] BIO_new_file("/root/bitradiology.chained.crt") failed (SSL: error:02001002:system library:fopen:No such
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 nginx[2420]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: nginx.service: Control process exited, code=exited status=1
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: nginx.service: Unit entered failed state.
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: nginx.service: Failed with result 'exit-code'.
lines 1-14/14 (END)
如何解决这个问题
检查你的conf文件在qazxsw poi显然,nginx不喜欢那里的一些行。
检查配置文件中的ssl_certificate说明。 Nginx显然说它无法找到指定的文件之一:
fopen:没有这样的文件或目录:fopen('/ root / bitradiology.chained.crt','r')
我在/etc/nginx/nginx.conf
目录中找到了这个bitradiology.chained.crt
文件。
然后转到以下目录cd /usr
并打开默认文件
cd /etc/nginx/sites-enabled
我编辑了这个文件,用sudo nano default
取代了/root/
/usr/
的/root/bitradiology.chained.crt
我先运行nginx配置测试:
/usr/bitradiology.chained.crt
测试成功后,我可以重启服务
nginx -t
NGINX已经启动,我的应用程序现在正在运行。
谢谢!!!