系统重启后 nginx 没有启动。尝试在终端中手动启动它。收到以下错误。它们是什么意思,我该如何修复它以便 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 Fri 2018-05-18 11:45:39 EDT; 10s ago
Docs: man:nginx(8)
Process: 23664 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
May 18 11:45:39 jUbuntu systemd[1]: Starting A high performance web server and a reverse proxy server...
May 18 11:45:39 jUbuntu nginx[23664]: nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
May 18 11:45:39 jUbuntu nginx[23664]: 2018/05/18 11:45:39 [emerg] 23664#23664: open() "/var/log/nginx/access.log" failed (2: No such file or directory)
May 18 11:45:39 jUbuntu nginx[23664]: nginx: configuration file /etc/nginx/nginx.conf test failed
May 18 11:45:39 jUbuntu systemd[1]: nginx.service: Control process exited, code=exited status=1
May 18 11:45:39 jUbuntu systemd[1]: nginx.service: Failed with result 'exit-code'.
May 18 11:45:39 jUbuntu systemd[1]: Failed to start A high performance web server and a reverse proxy server.
答案1
找到答案了:
里面/var/log/
没有nginx
文件夹。
我添加了一个nginx
文件夹,/var/log/
以便该/var/log/nginx
文件夹存在且可用。