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

posted @ 2020-12-21 14:28  仰望丶那一缕微光  阅读(3406)  评论(0编辑  收藏  举报