安装apache
yum install httpd -y
安装apache收册
yum install httpd-manual
将Apache服务添加到 开机自启中
systemctl start httpd
systemctl enable httpd
设置永久允许http
firewall-cmd --permanent --add-service=http
让防火墙重新加载策略
firewall-cmd --reload
列出防火墙信息
firewall-cmd --list-all
进入默认发布的目录,并编辑默认发布文件内容
vim /var/www/html/index.html
<h1>helloword<h1>
在查看直接的IP
IP add
然后在电脑浏览器中查看
输入:http://192.168.153.135
配置apache
先进入主配置文件
cd /etc/httpd/conf
在进入并编辑 httpd.conf
vim httpd.conf
将listen 80改为你要设置的端口
重启http的端口
systemctl restart httpd
防火墙添加端口号
firewall-cmd --permanent --add-port=5555/tcp
重新加载防火墙
firewall-cmd --reload
查看防火墙列表
firewall-cmd --list-all
临时关闭:(不用重启机器):
setenforce 0
查看5555端口
netstat -atunp |grep 5555