Commit 81efa46bee0c35bf0d1e468f3d309ccf4edc7ce2
1 parent
d8f33ac5
Updates 01_basic/httpd.md
Auto commit by GitBook Editor
Showing
1 changed file
with
32 additions
and
1 deletions
01_basic/httpd.md
| 1 | -# 安装httpd组件及配置 | ||
| 2 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +# 安装httpd组件及配置 | ||
| 3 | + | ||
| 4 | +### 安装httpd,配置httpd端口,配置防火墙规则 | ||
| 5 | +``` | ||
| 6 | +//------------ 安装httpd及配置 -------------// | ||
| 7 | +// 查看是否安装了httpd | ||
| 8 | +rpm -qa | grep httpd | ||
| 9 | +// 安装epel-release | ||
| 10 | +yum -y install epel-release | ||
| 11 | +// 安装httpd | ||
| 12 | +yum -y install httpd | ||
| 13 | +// 启动服务,设置开机自启 | ||
| 14 | +systemctl enable httpd | ||
| 15 | +systemctl start httpd | ||
| 16 | +// 查看服务列表 | ||
| 17 | +systemctl --type=service | grep httpd | ||
| 18 | +// 查看端口占用(默认80) | ||
| 19 | +netstat -tunlp | grep httpd | ||
| 20 | +// 修改默认端口 | ||
| 21 | +vi /etc/httpd/conf/httpd.conf | ||
| 22 | +定位到listener段修改端口 | ||
| 23 | +// 配置httpd的防火墙规则 | ||
| 24 | +cp /usr/lib/firewalld/serviced/http.xml /etc/firewalld/services/my_http.xml | ||
| 25 | +vi /etc/firewalld/services/my_http.xml | ||
| 26 | +将里面的short改成my_http,port改成8888 | ||
| 27 | +// 防火墙添加自定义服务,重新载入规则,显示服务 | ||
| 28 | +firewall-cmd --add-service=my_http -permanent | ||
| 29 | +firewall-cmd --reload | ||
| 30 | +firewall-cmd --list-service | ||
| 31 | +// http测试 | ||
| 32 | +curl -I 127.0.0.1:8888 | ||
| 33 | +``` | ||
| 3 | \ No newline at end of file | 34 | \ No newline at end of file |