配置selinux
在非标准端口82上运行WEB服务遇到问题,请解决:web服务器能够提供/var/www/html中所有现在有的html文件web服务器通过端口82访问web服务器在系统启动时能自动启动
检查selinux是否开启
#getenforce
或
#egrep -i selinux /etc/sysconfig/selinux | egrep -v “#”
检查semanage是否有安装
#yum install policycoreutils-python -y
重启apache
#systemctl restart httpd
启动apache报错查看错误日志
#journalctl -xn
日志里会出现一行"#semanage port -a -t PORT_TYPE -Ptcp 82"
使用semanage放通selinux安全策略端口
#semanage port -a -t http_port_t -p tcp 82
检查端口是否方通成功
#semanage port -l | grep ‘http’
重启apache并查看是否启动成功
#systemctl restart httpd
#netstat -tanp | grep httpd
检查页面是否正常
#systemctl restart httpd
#netstat -tanp | grep httpd
无法访问
使用restorecon来恢复selinux文件属性即恢复文件的安全上下文
#restorecon -Rv /var/www/html
再次检查
curl http://servera:82/a.htm