nginx -s reload 没有生效


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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM