一、报错
# 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 一 2024-02-26 10:49:11 CST; 3min 8s ago
Process: 2648 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
Process: 2647 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
2月 26 10:49:11 pool-100-0-43-111.bstnma.fios.verizon.net systemd[1]: Starting The nginx HTTP and reverse proxy server...
2月 26 10:49:11 pool-100-0-43-111.bstnma.fios.verizon.net nginx[2648]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2月 26 10:49:11 pool-100-0-43-111.bstnma.fios.verizon.net nginx[2648]: nginx: [emerg] open() "/etc/nginx/flschat_access.log" failed (13: Permis...nied)
2月 26 10:49:11 pool-100-0-43-111.bstnma.fios.verizon.net nginx[2648]: nginx: configuration file /etc/nginx/nginx.conf test failed
2月 26 10:49:11 pool-100-0-43-111.bstnma.fios.verizon.net systemd[1]: nginx.service: control process exited, code=exited status=1
2月 26 10:49:11 pool-100-0-43-111.bstnma.fios.verizon.net systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
2月 26 10:49:11 pool-100-0-43-111.bstnma.fios.verizon.net systemd[1]: Unit nginx.service entered failed state.
2月 26 10:49:11 pool-100-0-43-111.bstnma.fios.verizon.net systemd[1]: nginx.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
二、解决方法
关闭防火墙
systemctl disable firewalld
systemctl stop firewalld
关闭iptables
iptables -F
关闭selinux
1、临时
getenforce
setenforce 0
2、永久
修改配置文件 vim /etc/selinux/config SELINUX=enforcing改为disabled
ELINUX=disabled