1. Locate the httpd.conf file in the Apache \conf directory, open it, and locate the following two lines:
# Virtual Hosts
#Include conf/extra/httpd-vhosts.conf
Remove the # from the front of him and modify it as follows:
# Virtual Hosts
Include conf/extra/httpd-vhosts.conf
It means to enable the setting of the virtual host file httpd-vhosts.conf, the virtual host settings are set in this file, do not have to change the httpd.conf, so it is more clear.
2. Locate the httpd-vhost.conf file in the Apache \conf\extra directory.
When you open it, it already contains something like the following:
? virtual Host Configuration Start
ServerAdmin Webmaster@dummy-host.localhost
DocumentRoot "E:/wamp/www/ecshop"//Website root path-The directory of the virtual host, that is, the root directory of the domain name
ServerName "www.baidu.com"//Virtual Host domain name-the domain name you want
Serveralias Www.dummy-host.localhost
Errorlog "Logs/dummy-host.localhost-error.log"
Customlog "Logs/dummy-host.localhost-access.log" common
Also add the following before each virtual host configuration starts:
This is your virtual host's authorized directory generally with DocumentRoot ""? The directory of the virtual host, which is the same as the root directory of the domain name.
Options Indexes FollowSymLinks includes execcgi
AllowOverride All
Order Allow,deny
Allow from all
Allow from all-the directory defined above can be accessed only if allowed, otherwise the 503 error will be displayed when IE or Firefox is accessed, which is forbidden. This is the default Apache setting, and the last line is this
Deny from all means deny access to the root directory, and others cannot access your site.
So if you want other users to have access to your project, you have to change the
Allow from all
3. Locate the Hosts file in the C:\WINDOWS\system32\drivers\etc directory
Plus one sentence below.
127.0.0.1 www.baidu.com? This is your domain name, how many virtual hosts you want to set, and how many rows of such records will be added.
=========================================================================================================
Example
Options Indexes followsymlinks includes execcgiallowoverride allorder allow,denyallow
from all
ServerAdmin webmaster@dummy-host2.localhostdocumentroot E:\wamp\www\ecshopServerName Www.test.comErrorLog Logs/dummy-host2.localhost-error_logcustomlog Logs/dummy-host2.localhost-access_log Common