Apache Dynamic Virtual Host Configuration

Source: Internet
Author: User

Often adding virtual hosts to Apache Web server in development facilitates simultaneous operation of multiple projects, but each time a new project is added

All have to increase the VirtualHost    part, the time has been VirtualHost partly also many, looked at the headache.

If you use dynamic virtual host, it is more convenient, do not have to configure each time, only need to add a folder, of course, if it is local, you may also need to modify the "hosts" file to add a message,

For example:

Here's how to configure Apache dynamic virtual hosts simply :

1. Open the mod_vhost_alias module

The Apache httpd.conf file needs to be modified.

2.Apache uses the virtual host name (Server name) to generate self-referencing (self-referential) URLs and more.

When UseCanonicalName Off the virtual host name (server name) is taken from the contents of the header in the request Host: .

When UseCanonicalName DNS , the host name is obtained by DNS anti-resolution of the IP address of the virtual host.

3. Set the directory for the virtual host.

Virtualdocumentroot/www/hosts/%0/docs

/www/hosts/www.aa.com/docs file.

 

After the configuration is complete, for example: automatically corresponding directory according to the domain name to be accessed

Tips: If you modify the path you need to add directory, different versions of the wording is not very consistent, refer to the original configuration.

For example:

<directory "F:\www" >
Options-indexes +followsymlinks
AllowOverride All
Require all granted
</Directory>

Refer to the official documentation:

1.Dynamically configured Mass Virtual Hosting

2.mod_vhost_alias Module

3.Apache Core Features

Apache Dynamic Virtual Host Configuration

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.