1.安装httpd,并将访问apache服务器的首页修改为hello.html, 且内容为: "My Home Page is hello"
安装httpd :yum install httpd -y
[root@localhost ~]# yum install httpd -y
[root@localhost ~]# systemctl status firewalld #查看防火墙状态
[root@localhost ~]# systemctl stop firewalld # 关闭防火墙[root@localhost conf]# cd /var/www/html
[root@localhost html]# vim hello.html
[root@localhost html]#systemctl restart httpd
这里还需要将其改名
[root@localhost html]# mv hello.html index.html
[root@localhost html]# systemctl restart httpd网页输入ip
2.虚拟主机:虚拟两台主机ip为100,200, 对应访问目录:/www/ip/100, /www/ip/200
并创建首页文件index.html
3.配置不同端口的虚拟主机访问apache服务器
[root@localhost conf.d]# mkdir /www/port/{9090,9091}-p
[root@localhost conf.d]# echo "this is 9090" > /www/port/9090/index.html
[root@localhost conf.d]# echo "this is 9091" > /www/port/9091/index.html
[root@localhost conf.d]# vim myhost.conf
[root@localhost conf.d]#systemctl restart httpd
然后通过ip访问网站(后面为端口)