In Windows, how does Apache2 resolve different directories for different domain names? For more information, see
In Windows, how does Apache2 resolve different directories for different domain names? For more information, see
Configure the environment
System: win7
PHP version: 5.3.x
MYSQL version: 5.0.27
Apache: 2.2.4 (Win32)
Setting method:
Open D: \ wamp \ bin \ apache \ Apache2.2.17 \ conf \ httpd. conf
Add at last
NameVirtualHost *: 80
DocumentRoot "D: \ wamp \ www \ bbs"
ServerName www.a.com
Note the following When configuring:
ServerName *: 80
Here, * can be changed to the local ip address, for example, 192.168.1.11.
NameVirtualHost *: 80 VirtualHost *: 80 remains unchanged
Enter 127.0.0.1 www.a.com In the hosts file.
(Hosts file location:-Windows NT/2000/XP/2003/Vista default path: % SystemRoot % \ system32 \ drivers \ etc \)
In this way, the domain name a.com is bound to the root directory of the local machine, which is equivalent to http: // localhost or
Http: // 127.0.0.1 it is convenient to enter www.a.com.
Start the apache service and access it with the above Domain Name