解决SELinux导致Apache更改端口后无法启动的问题

systemctl start httpd    # 将Apache的默认端口改为90后,启动Apache时提示失败

systemctl status httpd    # 查看Apache的状态

可以看到提示:Permission denied: AH00072: make_sock: could not bind to address [::]:90,意思是说权限被拒绝:AH00072: make_sock:无法绑定到地址[::]:90

这是 SELinux 安全机制导致的

解决方法:

semanage port -l | grep http     # 查看现在支持的httpd端口

http_port_t   tcp  80, 81, 443, 488, 8008, 8009, 8443, 9000

可以看到http_port_t处没有90端口

semanage port -a -t http_port_t -p tcp 90    # 将90端口加入SELinux

systemctl restart httpd     # 重新启动Apache服务器

netstat -ntlp | grep http    # 查看端口状态,如下图,说明启动成功

原文地址:https://www.cnblogs.com/opsprobe/p/11385549.html