Selinux下httpd端口的设置

Selinux下端口的设置

(1)
yum install httpd -y ##安装服务 
systemctl start httpd ##开启服务

在这里插入图片描述
在这里插入图片描述

    此时Selinux状态为:Enforcing 
(2)netstat antlupe | grep httpd  ##查看httpd端口为80
 (3)  vim /etc/httpd/conf/httpd.conf  
       Listen 8080       ##修改端口为8080 (已认证存在的端口)
      systemctl restart httpd.service 
      netstat -antlupe | grep httpd   ##查看端口为8080  
(4) netstat -antlupe | grep 8888   ##随意设定的端口,查看不存在
      vim /etc/httpd/conf/httpd.conf 
       Listen  8888
      systemctl restart httpd.service 
       ##重启服务失败

(5)更改Selinux状态
      setenforce 0
      systemctl restart httpd.service  ##重启服务成功
   ##重新查看端口为8888
    netstat -antlupe | grep 8888
    netstat -antlupe | grep httpd

(2)netstat antlupe | grep httpd 在这里插入图片描述
(3) vim /etc/httpd/conf/httpd.conf
在这里插入图片描述
在这里插入图片描述
(4) netstat -antlupe | grep 8888 不存在非标准端口
在这里插入图片描述
vim /etc/httpd/conf/httpd.conf 在这里插入图片描述
在这里插入图片描述
(5)
在这里插入图片描述
######apache采用非标准端口,例如添加端口8888

增加selinux中的http端口
打开Selinux 状态

setenforce 1
getenforce
  Enforcing
semanage port -a -t http_port_t -p  tcp 8888
semanage port -l | grep http
  详解:
  -l 查询
  -a 增加

 systemctl restart httpd.service 
 netstat -antlupe | grep http   

在这里插入图片描述
在这里插入图片描述

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值