根據日誌的提示是/tmp/nginx/client_temp 這個目錄不存在,但是我反複檢查了這個目錄是存在的,我直接以/usr/local/nginx/sbin/nginx 進行操作沒有任何錯誤提示,實在是找不到原因在哪了,求大神指點迷津!!
錯誤如下:
[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.
目錄如果存在,應該要考慮權限問題
看著像是快取的路徑配置有問題,題主可以查看設定檔為啥會有這個路徑"/tmp/nginx/client_temp",如果是有意為之,則要確保該路徑存在、並且有相應的讀寫權限。
試試
nginx -c your_conf_file
,如果這個能成功,一般是權限問題。