wamp开启虚拟域名

1.首先确保httpd.conf引入httpd-vhosts.conf配置

Include conf/extra/httpd-vhosts.conf
默认都是开启状态

2.然后打开wamp64\bin\apache\apache2.4.23\conf\extra下的httpd-vhosts.conf 文件,在文件的最下面配置虚拟域名:

                                                                                     
        DocumentRoot "C:\wamp64\www\common\public"     //项目地址                                      
        ServerName www.partner.test.com                //虚拟域名
	ServerAlias partner.test.com 
                                                    
            Options FollowSymLinks Includes
            AllowOverride None
            Order deny,allow
            Allow from all                                                                               
                                                                                           
 

3.找到C盘,找到C:\Windows\System32\drivers\etc下面的hosts文件夹然后打开添加

127.0.0.1  www.partner.test.com

如果提示不允许修改host文件,可以将改文件复制到桌面修改后在替换回去

4.最后重启Apache。

附:配置的时候访问页面报错

462 Forbidden Region: Your request for this resource had been blocked. This resource is not available in your region.

原因是httpd-vhosts.conf中配置错误:

                                                                                            
DocumentRoot "C:\wamp64\www\common\public"     //项目地址                                      
        ServerName www.partner.test.com                //虚拟域名
	ServerAlias partner.test.com 
                                                   
            Options Indexes FollowSymLinks                                                                 
            AllowOverride All                                                                              
            Order allow,deny                                                                               
            Allow from all                                                                                 
                                                                                               
 

你可能感兴趣的:(wamp配置)