Home >Backend Development >PHP Tutorial >How to implement multi-website domain name binding in Apache2_PHP tutorial
Configuration environment
System: win7
PHP version: 5.3.x
MYSQL version: 5.0.27
Apache:2.2.4 (Win32)
Setting method:
Open D:wampbinapacheApache2 .2.17confhttpd.conf
Add
NameVirtualHost *:80 at the end
DocumentRoot "D:wampwwwbbs"
ServerName www.a.com
< ;/VirtualHost>
Note in the configuration:
ServerName *:80
The * here can be changed to the local IP such as 192.168.1.11
NameVirtualHost *:80 VirtualHost *:80 Keep Leave it unchanged
and then 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%system32driversetc)
In this way, the domain name a.com will be tied to the root directory of the local machine, which is equivalent to http://localhost or
http://127.0.0.1. It is more convenient to enter www.a.com.
Start the apache service and access it with the above domain name