无法启动nginx:“code = exited,status = 1 / FAILURE”

我刚刚在Debian Jessie上安装了nginx,我无法启动它:

$ sudo /etc/init.d/nginx start [....] Starting nginx (via systemctl): nginx.serviceJob for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details. failed! $ systemctl status nginx.service ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled) Active: failed (Result: exit-code) since Sat 2015-08-29 17:54:15 EDT; 6s ago Process: 16824 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS) Process: 8407 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE) Main PID: 691 (code=exited, status=0/SUCCESS) 

我已经运行了netstat -a -b并查看了列表,但是我看不到在端口80上运行的任何东西。

我怎样才能debugging呢?

更新:尝试sudo nginx -t看看它是否产生任何有用的:

 $ sudo nginx -t nginx: [emerg] BIO_new_file("/etc/nginx/certificates/certificate-178724.crt") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/nginx/certificates/certificate-123353.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file) nginx: configuration file /etc/nginx/nginx.conf test failed 

nginx -t的输出告诉你一切你需要知道的 – 它不能读取你的configuration引用的证书文件。 在/etc/nginx中提到这个文件,你会发现它被引用的文件。

有趣的是,在systemd之前的糟糕的黑暗的日子里,nginx的初始化脚本会直接给你提供这个错误。 粉碎新的世界秩序的另一个可用性胜利!