: This article mainly introduces how to set up the Apache virtual host vhost in php. if you are interested in the PHP Tutorial, refer to it. Address: http://blog.csdn.net/oneym/article/details/48050487
Author: oneym
I. environment description
1. use XAMPP In php environment
2. win7_64-bit system
3. install XAMPP In the C root directory
2. modify related files
1. Register the host header in the system
Use the text editing tool to editC:\Windows\System32\drivers\etc\hosts
File, add a line of records in the file as follows:
127.0.0.1 oneym.dev
2. enable the Apache vhost function
GoC:\xampp\apache\conf\httpd.conf
Edit the file and use the search function of the editor.ctrl+F
Searchmod_vhost_alias.so
Find the corresponding code, remove the # sign before the code, and edit the code as follows:
LoadModule vhost_alias_module modules/mod_vhost_alias.so
3. configure the Apache vhost function
EditC:\xampp\apache\conf\extra\httpd-vhosts.conf
File, add the following code at the end of the file:
DocumentRoot "C:/xampp/htdocs/php"
ServerName oneym.dev
ErrorLog "logs/oneym.dev-error.log"
CustomLog "logs/oneym.dev-access.log" common
4. restart the Apache server
You can use the control panel to quickly restart the Apache server, as shown below:
II. test
As shown in, the browser can directly use the host header we defined to access the project, so that our development is closer to the production environment.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above section describes how to set up the Apache virtual host (vhost) in php, including the following content. if you are interested in the PHP Tutorial, please help.