我的NGINX服务器已停止,并且正在生成错误。
我正在使用Ubantu 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)
如何解决此问题
答案 0 :(得分:0)
在/etc/nginx/nginx.conf
检查您的配置文件。显然,nginx不喜欢那里的某些行。
答案 1 :(得分:0)
检查配置文件中的 ssl_certificate 说明。 Nginx明确表示无法找到指定的文件之一:
fopen:没有这样的文件或 目录:的fopen(' /root/bitradiology.chained.crt',' R&#39)
答案 2 :(得分:0)
我在bitradiology.chained.crt
目录中找到了这个cd /usr
文件。
然后转到以下目录cd /etc/nginx/sites-enabled
并打开默认文件
sudo nano default
我修改了此文件,并将/root/
替换为/usr/
/root/bitradiology.chained.crt
的 /usr/bitradiology.chained.crt
我先运行nginx配置测试:
nginx -t
测试成功后,我可以重启服务
/etc/init.d/nginx restart
NGINX已经启动,我的应用程序现在正在运行。
感谢!!!