Configuring a virtual Host

Source: Internet
Author: User

1. Open the Apache configuration file httpd.conf See if the virtual host is open

#Include conf/extra/httpd-vhosts.conf to remove the previous #.

2. Open apache\conf\extra\httpd-vhosts.conf

Add the following code:

<virtualhost *:80>

DocumentRoot path under "D:/www/cms"--www

ServerName m.local.cc--URL to access

Errorlog "Logs/m.local.cc-error.log"

Customlog "Logs/m.local.cc-access.log" common

<directory "D:/www/cms" >

Options Indexes FollowSymLinks

DirectoryIndex index.html index.php

AllowOverride All

Order Allow,deny

Allow from all

</Directory>

</VirtualHost>

Let me talk a little bit about what the above code needs to change:

<virtualhost *:80> Here is the access port, if you are the other port please modify it yourself

DocumentRoot "D:/www/cms" This is the project's specific path, that is, you want to open the virtual host project

ServerName m.local.cc This (m.local.cc) is the URL you want to visit this project

Errorlog "Logs/m.local.cc-error.log" specifies the file saved by the error log

<directory "D:/www/cms" > here to keep the same as the project path

DirectoryIndex index.html index.php defines the index, which is the default access (index.html or index.php if present) when the project name is entered, but the specified access file is not entered.

3. Open C:\Windows\System32\drivers\etc\hosts File

Configure the IP that the local domain name points to, add it in the bottom-most space of the file ( the URL you write in httpd.conf must correspond ):

127.0.0.1 m.local.cc

After this, the entire local virtual host is configured to complete, and then reboot the Apache server! this is important.

Configuring a virtual Host

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.