目录
1.安装httpd,并将访问apache服务器的首页修改为hello.html 且内容为: "My Home Page is hello"
2.虚拟主机:虚拟两台主机ip为120,121, 对应访问目录:/www/ip/100, /www/ip/200

默认显示首页内容的文件为/var/www/html/下面的index.html
- [root@rhcsa ~]# cd /var/www/html/
- [root@rhcsa html]# ll
- total 132
- -rw-r--r--. 1 root root 12 Jul 26 11:21 index.html
- -rw-r--r--. 1 root root 17892 May 20 2021 LICENSE
- -rw-r--r--. 1 root root 31040 Jan 19 2021 qqqun.png
- drwxr-xr-x. 2 root root 124 May 20 2021 readme
- -rw-r--r--. 1 root root 71156 May 20 2021 readme.html
- drwxr-xr-x. 13 root root 4096 May 20 2021 upload
- drwxr-xr-x. 4 root root 94 May 20 2021 utility
- [root@rhcsa html]# more index.html
- hello world
- [root@rhcsa html]# mv index.html hello.html
- [root@rhcsa html]# ll
- total 132
- -rw-r--r--. 1 root root 12 Jul 26 11:21 hello.html
- -rw-r--r--. 1 root root 17892 May 20 2021 LICENSE
- -rw-r--r--. 1 root root 31040 Jan 19 2021 qqqun.png
- drwxr-xr-x. 2 root root 124 May 20 2021 readme
- -rw-r--r--. 1 root root 71156 May 20 2021 readme.html
- drwxr-xr-x. 13 root root 4096 May 20 2021 upload
- drwxr-xr-x. 4 root root 94 May 20 2021 utility
- [root@rhcsa html]# more hello.html
- hello world
[root@rhcsa html]# vim hello.html

- [root@rhcsa html]# more hello.html
- My Home Page is hello
然后在配置文件中修改默认打开文件为hello.html
[root@rhcsa conf]# vim httpd.conf
重启httpd服务
[root@rhcsa conf]# systemctl restart httpd
- [root@rhcsa 200]# nmcli connection modify ens224 +ipv4.addresses 192.168.40.120/24
- [root@rhcsa 200]# nmcli connection modify ens224 +ipv4.addresses 192.168.40.121/24
- [root@rhcsa 200]# nmcli c up ens224
[root@rhcsa ~]# mkdir /www/ip/{100,200} -p
绝对路径:/etc/httpd/conf.d/
建立myhosts.conf文件,在里面配置

- [root@rhcsa 100]# echo hello world! > index.html
- [root@rhcsa 200]# echo hello world!! > index.html

[root@rhcsa www]# mkdir port/{9090,9091} -p
- [root@rhcsa conf.d]# echo hello world9090 > /9090/index.html
- [root@rhcsa conf.d]# echo hello world9091 > /9091/index.html
[root@rhcsa conf.d]# vim /etc/httpd/conf.d/myhosts2.conf

[root@rhcsa conf]# systemctl restart httpd

