教你wamp下多域名如何配置

wamp下多域名配置问题

1.找到wamp安装目录的apache安装目录 找到 httpd.conf文件 例如我安装的目录为 E:\wamp\bin\apache\apache2.2.8\conf\httpd.conf
也可以通过wamp图标打开。查找 Virtual hosts  去掉下面include行前面的# 修改为
#Virtual hosts
Include conf/extra/httpd-vhosts.conf
这样就在配置文件中引入了httpd-vhosts.conf文件。
2. 在目录 如E:\wamp\bin\apache\apache2.2.8\conf\extra 下面找到刚刚包含进来的文件:httpd-vhosts.conf
打开文件 在最后面添加配置文件
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "E:/www"  
    ServerName    www.bzzxcs.com    
ServerAlias   www.bzzxcs.com
    ErrorLog "logs/ www.bzzxcs.com -errlo.log"
    CustomLog "logs/  www.bzzxcs.com -access.log" common
    <directory "E:/www">
        Options FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from all
    </directory>
</VirtualHost>
其中 ServerAdmin、ErrorLog 、CustomLog为可选配置,也可以不对其进行配置。
3.打开系统文件目录:C:\WINDOWS\system32\drivers\etc  找到hosts文件。在最下面添加刚才配置的域名 使域名生效。如:
127.0.0.1       www.bzzxcs.com自己可以根据需要多配置几个
4.重启apache服务。就ok了。
注意事项:
配置好以后原来的localhost就不可以使用了
只要在E:\wamp\bin\apache\apache2.2.8\conf\extra\httpd-vhosts.conf上添加
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "e:/wamp/www"  
    ServerName localhost   
ServerAlias localhost
    ErrorLog "logs/ www.bzzxcs.com -errlo.log"
    CustomLog "logs/ www.bzzxcs.com -access.log" common
    <directory "e:/wamp/www">
        Options FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from all
    </directory>
</VirtualHost>
然后在C:\WINDOWS\system32\drivers\etc\hosts 把 #127.0.0.1       localhost  注释去掉或者加上这句


在哪看你所有的是什么端口,就在 E:\wamp\bin\apache\apache2.2.8\conf\extra\httpd-

猜你喜欢

转载自blog.csdn.net/luo200618/article/details/75729609
今日推荐