基于域名

截止到正常通过http://192.168.80.111访问默认站点

Server:
1、创建两个web目录及网页
mkdir /var/www/html/web1
mkdir /var/www/html/web2
echo “web11111111” > /var/www/html/web1/index.html
echo “web22222222” > /var/www/html/web2/index.html
2、辅配置文件
(1)web1
vi /etc/httpd/conf.d/web1.conf

ServerName www.web1.com
DocumentRoot /var/www/html/web1

AllowOverride None
Require all granted


(2)web2
vi /etc/httpd/conf.d/web2.conf

ServerName www.web2.com
DocumentRoot /var/www/html/web2

AllowOverride None
Require all granted


3、重启httpd
systemctl restart httpd

Client:
1、修改hosts文件
C:/windows/system32/drivers/etc/hosts
192.168.80.111 www.web1.com
192.168.80.111 www.web2.com
2、浏览器访问
www.web1.com,www.web2.com

你可能感兴趣的:(lunux)