1, open the Apache directory with Notepad httpd file (e.g. D:\wamp\bin\apache\apache2.2.8\conf), find the following module # Virtual hosts #Includeconf/EXTRA/HTTPD-VH Osts.conf Remove the previous # so that the Httpd-vhosts virtual host file is turned on. This time restart Wamp environment, unable to open localhost, need to be configured in httpd-vhosts.conf. 2. Open the Host file (C:\WINDOWS\system32\drivers\etc\hosts), add a line of code 127.0.0.1 szyqbbs.com 3, open the Httpd-vhosts file with Notepad, Configure the localhost virtual host, refer to the Httpd-vhosts file in the instance, modified as follows:
<virtualhost *:80> documentroot "d:/wamp/www" ServerName myserver.com</virtualhost>< VirtualHost *:80> ServerAdmin [email protected] documentroot "D:/www/szyqbbs" ServerName szyqbbs.com errorlog "Logs/your_web_error.log" Customlog "Logs/your_web_access.log" common</virtualhost>
Modify the configuration as follows:
DocumentRoot Modify the WWW directory (for example: D:\wamp\www) in the local WAMP environment to ServerName to localhost or to a custom server such as Server.com 4, open test.biuuu.com in the browser, found the following error 403 Forbidden Error forbiddenyou don't have permission to access/on the this server. Analysis: This is mainly the directory access permissions are not set, you need to set access to the directory! 5. Open the httpd file and add the following statement
" d:/www/ "> Options Indexes followsymlinks allowoverride all Require all granted</ Directory>
6, restart Apache, virtual host configuration success! Note 1, directory path, such as E:\WEBROOT\BIUUU2, access permissions, such as the upper deny from all modified to allow from All3,host files, configure the virtual domain name host to point to the 4,httpd file, open the include conf/ extra/httpd-vhosts.conf module 5,httpd-vhosts file, configuring the virtual host
apache2.4.x Virtual Host Configuration