Software Required: XAMPP 2.5
After downloading a dummy installation, it is recommended to change the installation directory to a disk other than the C disk (the default site directory and MySQL data are in the installation directory)
I am here to install in D disk (D:/XAMPP)
After installation, open and start the Apache and MySQL services
Enter http://localhost in the browser, do not accidentally will see it works, then congratulations on your installation success
The above are the clouds, the following is the focus:
1. Confirm that Apache is opening the virtual host
Open d:/xampp/apache/conf/httpd.conf
Find include "conf/extra/httpd-vhosts.conf" confirmation before # has been removed
2. Set up multiple virtual hosts
Open d:/xampp/apache/conf/extra/httpd-vhosts.conf
Find Namevirtualhost *:80 confirm that the # in front is removed, or removed #
Copy the following code to the last line
| The code is as follows |
Copy Code |
<virtualhost *:80> # #ServerAdmin Postmaster@dummy-host2.localhost DocumentRoot "/xampp/htdocs/develop" ServerName develop.rin.com # #ServerAlias Www.dummy-host2.localhost # #ErrorLog ' Logs/dummy-host2.localhost-error.log ' # #CustomLog "Logs/dummy-host2.localhost-access.log" combined </VirtualHost> |
If you want to open another virtual host, then copy one to the last line, for example:
| The code is as follows |
Copy Code |
<virtualhost *:80> # #ServerAdmin Postmaster@dummy-host2.localhost DocumentRoot "/XAMPP/HTDOCS/DEVELOP2" ServerName develop2.rin.com # #ServerAlias Www.dummy-host2.localhost # #ErrorLog ' Logs/dummy-host2.localhost-error.log ' # #CustomLog "Logs/dummy-host2.localhost-access.log" combined </VirtualHost> |
Remember to save.
3. In the default and directory to create a new corresponding site directory, and put index.html (test)
Create D:/xampp/htdocs/develop
Create D:/xampp/htdocs/develop2
Remember to put in index.html (test)
4. Modify the host file (do domain name resolution)
Open C:/windows/system32/drivers/etc/hosts (Notepad opens)
Add the following two lines:
| The code is as follows |
Copy Code |
127.0.0.1 develop.rin.com 127.0.0.1 develop2.rin.com |
5. Restart Apache
End of configuration.