Apache installation is done by default does not open the virtual server, if you want to configure the virtual server on the local Apache, similar to the online purchase of virtual hosts, you can follow these steps to configure:
1, modify the Hosts file of this machine, the following example:
127.0.0.1 localhost
127.0.0.1 xlb.com
127.0.0.1 xlb2.com
2, open the Apache installation directory, find httpd.conf files, respectively, remove the following two lines of text before the # number.
LoadModule Vhost_alias_module modules/mod_vhost_alias.so
Remove # means to enable Apache's virtual host feature.
Include conf/extra/httpd-vhosts.conf
Removing this line of # means importing the virtual host configuration from the conf/extra/httpd-vhosts.conf file.
3, open the extra directory of the httpd-vhosts.conf file, the default configuration
<virtualhost *:80>
ServerAdmin Webmaster@dummy-host.localhost
DocumentRoot "/www/docs/dummy-host.localhost"
ServerName Dummy-host.localhost
Serveralias http://www.dummy-host.localhost/
ErrorLog "Logs/dummy-host.localhost-error_log"
Customlog "Logs/dummy-host.localhost-access_log Common"
</VirtualHost>
<virtualhost *:80>
ServerAdmin Webmaster@dummy-host2.localhost
DocumentRoot "/www/docs/dummy-host2.localhost"
ServerName Dummy-host2.localhost
ErrorLog "Logs/dummy-host2.localhost-error_log"
Customlog "Logs/dummy-host2.localhost-access_log Common"
</VirtualHost>
Change to the directory and domain name you want
<virtualhost *:80>
ServerAdmin Webmaster@dummy-host.localhost
DocumentRoot "d:/wamp/www/"
ServerName localhost
Serveralias localhost
ErrorLog "Logs/localhost-error_log"
</VirtualHost>
<virtualhost *:80>
ServerAdmin Webmaster@dummy-host.localhost
DocumentRoot "d:/wamp/www/web/"
ServerName test.com (fill in the main domain name)
Serveralias *.test.com (the server alias here can support universal resolution, that is, all subdomains can be resolved to bind to the virtual host)
ErrorLog "Logs/localhost-error_log"
</VirtualHost>
If you finish, there are 403 errors that are found in the httpd.conf:
<directory/>
Options followsymlinks execcgi Indexes
AllowOverride None
Order Deny,allow
Deny from all
Satisfy All
</Directory>
Change to
<directory/>
Options followsymlinks execcgi Indexes
AllowOverride None
# Order Deny,allow
# Deny from all
# Satisfy All
</Directory>
After the configuration is finished, you can enter xlb.com in the browser to access the site under your set directory.