apache基于端口的虚拟主机访问可能会遭到selinux的拦截
创建虚拟主机,端口80
[root@bogon ~]# cat /etc/httpd/conf.d/80.conf
servername localhost
documentroot /var/www/html
创建虚拟主机,端口8899
[root@bogon ~]# cat /etc/httpd/conf.d/8080.conf
servername 192.168.2.167
documentroot /var/www/8080
查看selinux对于apache的端口控制。
[root@bogon ~]# semanage port -l | grephttp
http_cache_port_t tcp 8080, 8118, 8123, 10001-10010
http_cache_port_t udp 3130
http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t tcp 5988
pegasus_https_port_t tcp 5989
semanage port -a -thttp_port_t -p tcp 8899
选项:port 表示对端口生效
-a --add,添加指定对象类型的记录Add a record of the specified object type
-t, 表示:--type TYPE SELinux Type for the object SELinux的对象类型。
-p 需要写明端口和端口的协议
更改写入内核,需要重启才能生效