在开启ESlinux 的情况下启用非常用端口会被阻止, 需要手动添加白名单情况.
nginx 启动的用户组
user nginx;
配置文件测试的端口
server { listen 8090; #does not work #listen 8080; #works #listen 9090; #does not work #listen 9090 default; #does not work neighter #listen 80; #works! server_name <some IP>; ... }
查看SElinux http 端口列表
semanage port -l | grep http_port_t http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000
添加自定义端口 例如 8090
semanage port -a -t http_port_t -p tcp 8090
如果你得到 semanage: command not found
, 需要安装软件包
# 查找命令对应的软件包名称 [root@123123 ~]# yum provides /usr/sbin/semanage Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * elrepo: ftp.ne.jp * epel: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp policycoreutils-python-2.5-33.el7.x86_64 : SELinux policy core python utilities Repo : base Matched from: Filename : /usr/sbin/semanage
CentOS 7 安装命令:
yum install policycoreutils-python
CentOS 8 安装命令:
yum install policycoreutils-python-utils
nginx: no permission to bind port 8090 but it binds to 80 and 8080
How to Fix ‘semanage command’ Not Found Error in CentOS/RHEL