According to the log prompt, the directory /tmp/nginx/client_temp does not exist, but I checked many times and found that this directory exists. I directly operated with /usr/local/nginx/sbin/nginx and there was nothing Error message, I really can’t find the reason, please give me some guidance!!
The error is as follows:
[root@iZ94ss71ojfZ nginx]# systemctl status nginx
nginx.service - nginx - high performance web server
Loaded: loaded (/etc/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since Thu 2016-08-18 01:33:15 CST; 1s ago
Docs: http://nginx.org/en/docs/
Process: 15731 ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf (code=exited, status=1/FAILURE)
Aug 18 01:33:15 iZ94ss71ojfZ systemd[1]: Starting nginx - high performance web server...
Aug 18 01:33:15 iZ94ss71ojfZ nginx[15731]: nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
Aug 18 01:33:15 iZ94ss71ojfZ nginx[15731]: nginx: [emerg] mkdir() "/tmp/nginx/client_temp" failed (2: No such file or directory)
Aug 18 01:33:15 iZ94ss71ojfZ nginx[15731]: nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
Aug 18 01:33:15 iZ94ss71ojfZ systemd[1]: nginx.service: control process exited, code=exited status=1
Aug 18 01:33:15 iZ94ss71ojfZ systemd[1]: Failed to start nginx - high performance web server.
Aug 18 01:33:15 iZ94ss71ojfZ systemd[1]: Unit nginx.service entered failed state.
If the directory exists, permission issues should be considered
It seems that there is a problem with the cache path configuration. The questioner can check why the configuration file has this path "/tmp/nginx/client_temp". If it is intentional, make sure that the path exists and has the corresponding Read and write permissions.
Try it
nginx -c your_conf_file
, if this works, it’s usually a permissions issue.