This article will introduce to you how to quickly build a local apache + php + mysql development environment for windows, and how to access multiple website domain names.
Required Software: XAMPP 2.5
After downloading the installation, we recommend that you change the installation directory to a disk other than drive C (the default site directory and mysql data are in the installation directory)
I am installing it on drive D (D:/xampp)
After installation, open and start the apache and mysql services.
Enter http: // localhost in the browser and you will see It Works without accident. Congratulations! The installation is successful.
The above is a float cloud, and the following is the focus:
1. Check whether apache has enabled the VM.
Open D:/xampp/apache/conf/httpd. conf
Locate Include "conf/extra/httpd-vhosts.conf" and confirm that the previous # has been removed
2. Set multiple virtual hosts
Open D:/xampp/apache/conf/extra/httpd-vhosts.conf
Find NameVirtualHost *: 80. Check that the previous one is removed. Otherwise, remove it #
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 Vm, copy it 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.create a site directory in the tracking directory and add it to index.html (for testing)
Create D:/xampp/htdocs/develop
Create D:/xampp/htdocs/develop2
Into index.html (for testing)
4. Modify the host file (for domain name resolution)
Open C:/Windows/System32/drivers/etc/hosts (Open notepad)
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
Configuration ends so far