Home >Backend Development >PHP Tutorial >php sets Apache virtual host vhost
This article address: http://blog.csdn.net/oneym/article/details/48050487
Author: oneym
1. Environment description
1. Use PHP environment and use XAMPP
2. win7_64-bit system
3. XAMPP is installed in the root directory of drive C
2. Modify related files
Use a text editing tool to edit the C:WindowsSystem32driversetchosts
file and add a line of records in the file as follows: 127.0.0.1 php sets Apache virtual host vhost
Locate the C:xamppapacheconfhttpd.conf
file to start editing, use the editor’s search function ctrl+F
Search for mod_vhost_alias.so
;After finding the corresponding code, remove the # sign in front of the code. After editing, it will look as follows: LoadModule vhost_alias_module modules/mod_vhost_alias.so
Edit C:xamppapacheconfextrahttpd-vhosts.conf
file, add the following code at the end of the file:
<virtualhost> <br>
DocumentRoot "C:/xampp/htdocs/php" <br>
ServerName php sets Apache virtual host vhost <br>
ErrorLog "logs/php sets Apache virtual host vhost-error.log" <br>
CustomLog "logs/php sets Apache virtual host vhost-access.log" common <br>
</virtualhost>
Use the control panel to quickly restart the Apache server. The screenshot is as follows:
2. Test
As shown in the figure below, you can directly use the browser we defined The host head comes to access the project, so that our development can be moved closer to the production environment.
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces how to set up the Apache virtual host vhost in PHP, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.