Apache configuration vhost supports multiple sites

Source: Internet
Author: User

Apache configuration vhost supports multiple sites

Each developer may develop multiple projects at the same time. Even if a project is developed, the configuration of multiple module sites may occur. Using vhost in apache is a good solution. It not only solves the problem of web directory switching, but also ensures that cookies take effect normally. The vhost configuration is very simple. Follow these three steps:

1. Enable the apache vhost Module

In the http. conf configuration file, locate this line and remove #

# LoadModule vhost_alias_module modules/mod_vhost_alias.so

Remove the # sign before the Include conf/extra/httpd-vhosts.conf line below, indicating that the configuration information of the vhost is read from the configuration file

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

2. configure a vhost

We configure a vhost in the configuration file. The default configuration file has example in it. Let's modify it with reference (# note is the key)

 

 
  
ServerAdmin webmaster@dummy-host.example.com DocumentRoot "c:/Apache2/docs/dummy-host.example.com" # web directory path ServerName dummy-host.example.com # host name ServerAlias www.dummy-host.example.com ErrorLog "logs/dummy-host.example.com-error.log" CustomLog "logs/dummy-host.example.com-access.log" common
 

 

3. Restart apache

 

FAQ:

1. How to Solve the 403 problem?

The 403 error occurs because the Directory has no access permission. Therefore, modify the Directory label in http. conf.

 

 
      Options FollowSymLinks    AllowOverride None    Order deny,allow    Allow from 127.0.0.1
 


 

Related Article

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.