nginx -s reload 有時候重新加載配置文件沒有生效
檢查/var/log/nginx/error.log
[notice] 29410#0: signal process started
[emerg] 2999#0: bind() to 0.0.0.0:9091 failed (13: Permission denied)
如果出現此情況,根據報錯內容分析
原因seLinux限制了http的端口
方案一 關閉seLinux(親測有效)
修改/etc/selinux/config文件中的SELINUX="" 為 disabled ,然后重啟。
如果不想重啟系統,使用命令setenforce 0
注:
setenforce 1 設置SELinux 成為enforcing模式
setenforce 0 設置SELinux 成為permissive模式
在lilo或者grub的啟動參數中增加:selinux=0,也可以關閉selinux
方法二:添加seLinux允許的http端口
1、查看端口是否加入seLinux允許的http端口
semanage port -l | grep http_port_t
2、添加端口
semanage port -a -t http_port_t -p tcp 8090
如果出現 semanage command not found錯誤就執行
yum -y install policycoreutils-python
參考鏈接 https://blog.csdn.net/ouyangtianhan/article/details/79815961