Php sets the Apache Virtual Host vhost and the apache Virtual Host vhost
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:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/php"
ServerName oneym.dev
ErrorLog "logs/oneym.dev-error.log"
CustomLog "logs/oneym.dev-access.log" common
</VirtualHost>
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.