PHP set Apache virtual host Vhost

Source: Internet
Author: User
This address: http://blog.csdn.net/oneym/article/details/48050487
Author: Oneym

I. Description of the Environment

1, using the PHP environment to use XAMPP
2. Win7_64 bit System
3, XAMPP installed in the C packing directory

Ii. modification of relevant documents

1. Register the host header in the system

Using the text Editing tool C:\Windows\System32\drivers\etc\hosts to edit the file, add a row of records to the file as follows:
127.0.0.1 oneym.dev

2. Enable Apache's Vhost function

Navigate to a C:\xampp\apache\conf\httpd.conf file to start editing, search using the editor's search function, ctrl+F mod_vhost_alias.so and after you find the code, remove the # number in front of the code, as shown below when editing is complete:
LoadModule vhost_alias_module modules/mod_vhost_alias.so

3. Configure Apache's Vhost function

Edit the C:\xampp\apache\conf\extra\httpd-vhosts.conf file and add the following code to 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 Apache Server

Use the control Panel to quickly restart the Apache server, as follows:

Second, the test

As shown, the browser can directly use our defined host header to access the project, this can be our development into a more close to the production environment.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the PHP set Apache virtual host Vhost, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.