nginx启动报错:
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[root@tomcat nginx]# service nginx restart Redirecting to /bin/systemctl restart nginx.service Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. [root@tomcat nginx]# systemctl status nginx.service ● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since 三 2020-02-26 12:27:43 CST; 56s ago Process: 58569 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS) Process: 58605 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE) Process: 58603 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) Main PID: 58571 (code=exited, status=0/SUCCESS) 2月 26 12:27:43 tomcat systemd[1]: Starting The nginx HTTP and reverse proxy server... 2月 26 12:27:43 tomcat nginx[58605]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 2月 26 12:27:43 tomcat nginx[58605]: nginx: [emerg] open() "/etc/nginx/logs/error.log" failed (13: Permission denied) 2月 26 12:27:43 tomcat nginx[58605]: nginx: configuration file /etc/nginx/nginx.conf test failed 2月 26 12:27:43 tomcat systemd[1]: nginx.service: control process exited, code=exited status=1 2月 26 12:27:43 tomcat systemd[1]: Failed to start The nginx HTTP and reverse proxy server. 2月 26 12:27:43 tomcat systemd[1]: Unit nginx.service entered failed state. 2月 26 12:27:43 tomcat systemd[1]: nginx.service failed.
解决方法:
vim /etc/sysconfig/selinux
SELINUX=enforcing 改为 SELINUX=disabled
重启服务器:reboot后,再次service nginx restart 即可成功。