前言

httpd

配置

yum install httpd -yrpm -ql httpd | grep /etctree /etc/httpdconfconf.d
yum install curl -ysystemctl start httpd/var/www/html/index.htmlecho Hello, World! > /var/www/html/index.htmlcurl 192.168.32.128

实验

我们成功下载 Apache Web 服务器,并且成功访问了他的静态页面,我们也可以写一些配置文件对细节做一些设置

基于不同IP访问

nmcli connection modify ens33 +ipv4.addresses 192.168.32.100/24 +ipv4.addresses 192.168.32.200/24nmcli connection up ens33index.htmlmkdir -p /var/www/ip/{100,200}cat /usr/share/doc/httpd/httpd-vhosts.confvim /etc/httpd/conf.d/ip.confsystemctl restart httpdcurl 192.168.32.100curl 192.168.32.200

基于不同端口访问

mkdir -p /var/www/port/{10000,20000}vim /etc/httpd/conf.d/port.confsystemctl restart httpd

基于域名访问

mkdir /var/www/portnmcli connection modify ens33 +ipv4.addresses 192.168.32.10/24echo this is a test > /var/www/host/index.htmlvim /etc/httpd/conf.d/host.confsystemctl restart httpdvim /etc/hostsC:\Windows\System32\drivers\etc\hostscurl www.test.com