Selinux_port_上下文

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   需要写明端口和端口的协议


更改写入内核,需要重启才能生效

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值