centos下以systemctl方式启动nginx报错

【字号: 日期:2022-07-20浏览:24作者:雯心

问题描述

根据日志的提示是 /tmp/nginx/client_temp 这个目录不存在,但是我反复检查了好多遍,这个目录是存在的,我直接以 /usr/local/nginx/sbin/nginx 进行操作没有任何错误提示,实在是找不到原因在哪了,求大神指点迷津!!

错误如下:

[root@iZ94ss71ojfZ nginx]# systemctl status nginxnginx.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 okAug 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 failedAug 18 01:33:15 iZ94ss71ojfZ systemd[1]: nginx.service: control process exited, code=exited status=1Aug 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.

问题解答

回答1:

目录如果存在,应该要考虑权限问题

回答2:

看着像是缓存的路径配置有问题,题主可以查看配置文件为啥会有这个路径'/tmp/nginx/client_temp',如果是有意为之,则要确保该路径存在、并且有相应的读写权限。

回答3:

试试nginx -c your_conf_file,如果这个能成功,一般是权限问题。

相关文章: