Php sets the Apache Virtual Host vhost and the apache Virtual Host vhost

Source: Internet
Author: User

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\hostsFile, 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.confEdit the file and use the search function of the editor.ctrl+FSearchmod_vhost_alias.soFind 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.confFile, 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.