本地apache解析多域名,多主機

1、打開Apache/conf/httpd.conf,找到
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
把第二行前面的註釋去掉,這樣就可以通過修改httpd-vhosts.conf文件來達到配置虛擬主機的目的。

2、然後在httpd-vhosts.conf文件內容配置如下內容
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "d:/AppServ/www"
    ServerName localhost
    ServerAlias www.localhost
 <Directory "d:/AppServ/www">
     Options Indexes FollowSymLinks MultiViews ExecCGI
     AllowOverride All
     Order allow,deny
     Allow from all
 </Directory>
    ErrorLog "logs/dummy-host.x-error.log"
    CustomLog "logs/dummy-host.x-access.log" common
</VirtualHost><VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "D:/AppServ/www1"
    ServerName hennanji.com
    ServerAlias www.hennanji.com
 <Directory "D:/AppServ/www1">
     Options Indexes FollowSymLinks MultiViews ExecCGI
     AllowOverride All
     Order allow,deny
     Allow from all
 </Directory>
    ErrorLog "logs/dummy-host.x-error.log"
    CustomLog "logs/dummy-host.x-access.log" common
</VirtualHost>
3、最後修改hosts文件,在c:/windows/system32/drivers/etc/下面的hosts,添上兩條
127.0.0.1 www.gtlions.com
127.0.0.1 gtlions.com
4、重啓apache即可
-The End-

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