您的位置:首页技术文章
文章详情页

centos 7 nginx开机自启动失败,找不到原因

【字号: 日期:2024-06-12 16:38:30浏览:76作者:猪猪

问题描述

[root@localhost ~]# systemctl status nginx.service -l● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since 二 2017-07-04 11:59:56 CST; 2h 20min ago Process: 1129 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE) Process: 1125 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)7月 04 11:59:52 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server...7月 04 11:59:56 localhost.localdomain nginx[1129]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok7月 04 11:59:56 localhost.localdomain nginx[1129]: nginx: [emerg] open() '/logs/adminchuxing.yunjiebao.cc.80.access.log' failed (13: Permission denied)7月 04 11:59:56 localhost.localdomain nginx[1129]: nginx: configuration file /etc/nginx/nginx.conf test failed7月 04 11:59:56 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=17月 04 11:59:56 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.7月 04 11:59:56 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.7月 04 11:59:56 localhost.localdomain systemd[1]: nginx.service failed.

centos 7 nginx开机自启动失败,找不到原因

权限已经全开给nginx的进程所有者了,为啥还是不行?

[root@localhost ~]# ll /logs总用量 56-rwxrwxrwx. 1 www-data www-data 43890 6月 28 11:23 adminchuxing.yunjiebao.cc.80.access.log-rwxrwxrwx. 1 www-data www-data 908 6月 26 17:30 chuxing.yunjiebao.cc.80.access.logdrwxrwxrwx. 2 www-data www-data 4096 7月 4 10:24 mfxxadmindrwxrwxrwx. 2 www-data www-data 4096 7月 4 10:00 mfxxapi

nginx.conf文件配置:

[root@localhost nginx]# cat nginx.confuser www-data vboxsf;worker_processes auto;error_log /var/log/nginx/error.log;pid /run/nginx.pid;events { use epoll; worker_connections 51200; multi_accept on;}

问题解答

回答1:

chmod nginx:nginx -R adminchuxing.yunjiebao.cc.80.access.log

回答2:

nginx.conf 里面的 user 的权限都打开了麼??你试一试把 user 对应的值改成 root ,看看能不能启动

回答3:

nginx: [emerg] open() '/logs/adminchuxing.yunjiebao.cc.80.access.log' failed (13: Permission denied)这不是很清楚吗

回答4:

配置文件和日志文件的读写权限没给到自启动nginx用户或者组吧

相关文章: