Ubuntu 16.04 Nginx无法启动

问答中心分类: NginxUbuntu 16.04 Nginx无法启动
liumy asked 8 年 ago
root@niaoyun60423:~# service nginx start
Job for nginx.service failed because a configured resource limit was exceeded. See "systemctl status nginx.service" and "journalctl -xe" for details.
root@niaoyun60423:~# systemctl status nginx.service
● nginx.service - LSB: nginx init.d dash script for Ubuntu <=9.10.
Loaded: loaded (/etc/init.d/nginx; bad; vendor preset: enabled)
Active: failed (Result: resources) since Sat 2016-10-22 13:09:10 CST; 20s ago
Docs: man:systemd-sysv-generator(8)
Process: 51350 ExecStart=/etc/init.d/nginx start (code=exited, status=0/SUCCESS)

Oct 22 13:09:10 niaoyun60423 systemd[1]: Starting LSB: nginx init.d dash script for Ubuntu <=9.10....
Oct 22 13:09:10 niaoyun60423 nginx[51350]: * Starting Nginx Server...
Oct 22 13:09:10 niaoyun60423 nginx[51350]: nginx: [emerg] open() "/data/wwwlogs/error_nginx.log" failed (2: NoOct 22 13:09:10 niaoyun60423 nginx[51350]: ...done.
Oct 22 13:09:10 niaoyun60423 systemd[1]: nginx.service: PID file /var/run/nginx.pid not readable (yet?) after Oct 22 13:09:10 niaoyun60423 systemd[1]: Failed to start LSB: nginx init.d dash script for Ubuntu <=9.10..
Oct 22 13:09:10 niaoyun60423 systemd[1]: nginx.service: Unit entered failed state.
Oct 22 13:09:10 niaoyun60423 systemd[1]: nginx.service: Failed with result 'resources'.
lines 1-14/14 (END)
root@niaoyun60423:~# journalctl -xe
--
-- Kernel start-up required KERNEL_USEC microseconds.
--
-- Initial RAM disk start-up required INITRD_USEC microseconds.
--
-- Userspace start-up required 53478 microseconds.
Oct 22 13:07:51 niaoyun60423 systemd[1]: Started User Manager for UID 0.
-- Subject: Unit user@0.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user@0.service has finished starting up.
--
-- The start-up result is done.
Oct 22 13:09:10 niaoyun60423 systemd[1]: Starting LSB: nginx init.d dash script for Ubuntu <=9.10....
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has begun starting up.
Oct 22 13:09:10 niaoyun60423 nginx[51350]: * Starting Nginx Server...
Oct 22 13:09:10 niaoyun60423 nginx[51350]: nginx: [emerg] open() "/data/wwwlogs/error_nginx.log" failed (2: NoOct 22 13:09:10 niaoyun60423 nginx[51350]: ...done.
Oct 22 13:09:10 niaoyun60423 systemd[1]: nginx.service: PID file /var/run/nginx.pid not readable (yet?) after Oct 22 13:09:10 niaoyun60423 systemd[1]: Failed to start LSB: nginx init.d dash script for Ubuntu <=9.10..
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has failed.
--
-- The result is failed.
Oct 22 13:09:10 niaoyun60423 systemd[1]: nginx.service: Unit entered failed state.
Oct 22 13:09:10 niaoyun60423 systemd[1]: nginx.service: Failed with result 'resources'.

5 Answers
oneinstack answered 8 年 ago
nginx -t 检查语法看看

liumy answered 8 年 ago
root@niaoyun60423:~# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: [emerg] open() "/data/wwwlogs/error_nginx.log" failed (2: No such file or directory)
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

发现挂载的数据盘/data下面是空的,没有wwwroot,MySQL这些文件夹。

oneinstack answered 8 年 ago
很明显报错啊

liumy answered 8 年 ago
不懂为什么安装之后/data盘是空的

oneinstack answered 8 年 ago
你是安装后挂载了磁盘吧。安装后不做任何动作试试!