lihao
By:
lihao

Can't start Nginx - Job for nginx.service failed

December 2, 2016 51 views
Nginx CentOS

nginx -t -c /etc/nginx/nginx.conf successful

/var/tmp/nginx/client This path already exists

[root@localhost client]# systemctl status nginx.service -l
● nginx.service - nginx
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2016-12-01 17:12:07 PST; 1h 6min ago

Dec 01 17:12:07 localhost.localdomain systemd[1]: Starting nginx...
Dec 01 17:12:07 localhost.localdomain nginx[7706]: nginx: [emerg] mkdir() "/var/tmp/nginx/client/" failed (2: No such file or directory)
Dec 01 17:12:07 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
Dec 01 17:12:07 localhost.localdomain systemd[1]: Failed to start nginx.
Dec 01 17:12:07 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Dec 01 17:12:07 localhost.localdomain systemd[1]: nginx.service failed.
Dec 01 17:26:32 localhost.localdomain systemd[1]: Stopped nginx.
Dec 01 17:28:44 localhost.localdomain systemd[1]: Stopped nginx.
Dec 01 18:07:51 localhost.localdomain systemd[1]: [/usr/lib/systemd/system/nginx.service:1] Unknown section 'aUnit'. Ignoring.

1 Answer

sudo nginx -t

This command will check your configuration files for nginx and provide some information on where the problem may be. It does look like the directory /var/tmp/nginx doesn't exist while the service is trying to use it.

Have another answer? Share your knowledge.