Solution One: Differentiate different virtual hosts by port
① follow the method of binding a site to prepare
1. First Develop your own website (d:/myblog (stored in the MyBlog directory of D-disk))
2. Configure the httpd.conf file (stored in the Conf folder of the Apache installation directory) and enable httpd-vhosts.conf (remove the # number in front of the second line).
3. Configure the httpd-vhosts.conf file (stored in the extra folder of the Apache installation directory)
4. Add IP and domain name correspondence in the Hosts file
C:/windows/system32/drivers/etc/hosts
5. It is recommended to unregister the DocumentRoot (document root) in the httpd.conf file
6. Test, enter "Http://www.shunping1.com" in the browser to see the site homepage
② Add a new domain name to the IP binding:
1. Developing a new website: d:/myblog2
2. Configure the httpd.conf file (stored in the Conf folder of the Apache installation directory) to add a new virtual host
3. Always allow Apache to listen on port 81 in the httpd.conf file
4. Add a new domain name to the Hosts file
5. Test, enter "Http://www.shunping3.com:80" in the browser (must add port name)
Solution two: Distinguish different domain names through the servername end
1. Develop a new site D:/MYBLOG2
2. In the httpd.conf file, let Apache unblock 81 ports (add # or delete directly)
3. Add the configuration in the httpd-vhosts.conf file (note that the configuration and scenario one here are not the same)
4. Other configurations are the same
The above describes the PHP implementation of an IP (such as: 127001) and multiple domain names (virtual host) of the binding, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.