every time you set up a virtual domain to search the online tutorial, this time simply record down, later on their own. we know that the IP address of the local Web development access is generally 127.0.0.1, the default map is the domain name of localhost, the general Access form is localhost/filename. now our root directory (XAMPP for htdocs,wamp and lamp is WWW) under a number of projects, assuming that there are engineering a and engineering B, each access to manually input A/b directory, the directory is more deep when you want to enter a multilevel directory structure (for example, I set up a test project, It also contains other projects, so it is not only annoying and not beautiful, so setting up a virtual host is an essential step in the development of comfort. now suppose I want to access the index.php file under the A directory, set the Access form to www.a.xyz/index.php. The force lattice suddenly high. It's also a lot easier when you have multiple catalogs. Too much nonsense, here is the procedure. (in XAMPP operation, other similar, all Apache operations)One: Open the Apache configuration file, conf/httpd.conf. Search for include conf/extra/httpd-vhosts.conf to make sure there is no "#" in front of you to ensure that httpd-vhosts.conf is introduced. It can also be seen from a name as a configuration file for a virtual host. Two: Open the conf/extra/httpd-vhosts.conf file, will namevirtualhost *:80 front of the # #删除, the following configuration will take effect. And then join the following<virtualhost *:80>
documentroot "G:/xampp/htdocs/lingeros/test"
ServerName
www.a.xyz
</VirtualHost>above the second behavior the virtual domain name points to the root directory, depending on the actual modification. The default will point to this directory, so also set localhost (below this to be placed in the back, the pro-Test put the front of the previous set does not take effect);<virtualhost *:80>
DocumentRoot "g:/xampp/htdocs/"
ServerName
localhost
</VirtualHost>
Three: Modify the C:\Windows\System32\drivers\etc\hosts fileJoin 127.0.0.1 www.a.xyz(PS: This file is very interesting, with it, fq into a fool-like operation)Four: Restart Apache service at this time can happily use Www.a.xyz/filename to visit
Apache set up virtual host on Windows (XAMPP for example)