赞
踩
1.要求搭建web服务器,能够访问到网页内容为“小胖,你咋这么胖呢!”
2.要求搭建web服务器,创建基于域名的虚拟主机,能够使用www.xiaopang.com和www.dapang.com访问各自的网站网站存放路径分别为/xiaopang和/dapang,内容自定。
- [root@localhost ~]# mount /dev/sr0 /mnt ---获取软件包,挂载光盘
- mount: /mnt: WARNING: device write-protected, mounted read-only.
- [root@localhost ~]# vim /etc/yum.repos.d/base.repo ---配置yum源
- [root@localhost ~]# dnf install httpd -y --安装软件包
- [root@localhost ~]# systemctl stop firewalld.service
-
- [root@localhost ~]# setenforce 0
- [root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf
-
- <VirtualHost 192.168.101.129:80>
- ServerName 192.168.101.129
- DocumentRoot /www/openlab
- </VirtualHost>
- <Directory /www>
- AllowOverride none
- Require all granted
- </Directory>
-
- [root@localhost ~]# mkdir -p /www/openlab
- [root@localhost ~]# echo "小胖,你怎么那么胖!" > /www/openlab/index.html
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# nmcli connection modify ens160 ipv4.method manual ipv4.addresses 192.168.101.129/24 +ipv4.addresses 192.168.101.139/24 +ipv4.addresses 192.168.101.149/24 ipv4.gateway 192.168.101.2 ipv4.dns 114.114.114.114 connection.autoconnect yes
[root@localhost ~]# nmcli connection up ens160
- [root@localhost ~]# systemctl stop firewalld.service
- [root@localhost ~]# setenforce 0
- vim /etc/httpd/conf.d/vhosts.conf
- <VirtualHost 192.168.101.139:80>
- ServerName www.xiaopang.com
- DocumentRoot /www/xiaopang
- </VirtualHost>
-
- <VirtualHost 192.168.101.149:80>
- ServerName www.dapang.com
- DocumentRoot /www/dapang
- </VirtualHost>
- [root@localhost ~]# mkdir -p /www/xiaopang
- [root@localhost ~]# mkdir -p /www/dapang
- [root@localhost ~]# echo 我爱linux > /www/xiaopang/index.html
- [root@localhost ~]# echo linux 真难学 > /www/dapang/index.html
vim /etc/hosts
systemctl restart httpd
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。