centos apache 基於域名的虛擬主機

基於域名的虛擬主機

NameVirtualHost 192.168.0.94:
<VirtualHost www.web1.com>
ServerName www.web1.com:80
DocumentRoot /var/www/web1
DirectoryIndex index.html index.htm
</VirtualHost>
<VirtualHost www.web2.com>
ServerName www.web2.com:80
DocumentRoot /var/www/web2
DirectoryIndex index.html index.htm
</VirtualHost>

然後大家在,linux下的/etc/hosts文件或者windows下C:/WINNT/system32/drivers/etc/hosts文件中,加入
192.168.0.94 www.web1.com
192.168.0.94 www.web2.com

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章