apache基于端口的虛擬主機(jī)訪問(wèn)可能會(huì)遭到selinux的攔截
創(chuàng)建虛擬主機(jī),端口80
[root@bogon ~]# cat? /etc/httpd/conf.d/80.conf
servername localhost
documentroot /var/www/html
創(chuàng)建虛擬主機(jī),端口8899
[root@bogon ~]# cat? /etc/httpd/conf.d/8080.conf
servername 192.168.2.167
documentroot /var/www/8080
查看selinux對(duì)于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
選項(xiàng):port??? 表示對(duì)端口生效
?????? ? -a?????? --add,添加指定對(duì)象類型的記錄Add a record of the specified object type
-t,? 表示:--type TYPE? SELinux Type for the object? SELinux的對(duì)象類型。
?????? ? -p???需要寫明端口和端口的協(xié)議
更改寫入內(nèi)核,需要重啟才能生效