Apache2 to achieve the multi site domain name binding method

  • 2020-05-07 19:23:06
  • OfStack

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 the end
NameVirtualHost *:80
< VirtualHost *:80 >
DocumentRoot "D:\wamp\www\bbs"
ServerName www.a.com
< /VirtualHost >

Note in the configuration:
ServerName *:80
The * here can be changed to native ip such as 192.168.1.11
NameVirtualHost *:80 VirtualHost *:80 remains unchanged
Write a sentence in the hosts file: 127.0.0.1 www.a.com
(Hosts file location: - Windows NT / 2000 / XP / 2003 / Vista default path: % SystemRoot % \ system32 \ drivers \ etc \)
This ties the domain name a.com to the local root, which is equivalent to http://localhost or
http://127.0.0.1 www.a.com is more convenient.

Start the apache service and access it with the above domain name

Related articles: