Bind multiple domain names or websites using Apache settings

Source: Internet
Author: User

One server installed Apache, how to bind multiple domain names or websites?

The simplest and most efficient method is as follows:

1. First open the Apache configuration file httpd.conf, in this file,

Find this sentence: "#Include etc/extra/httpd-vhosts.conf"

(The path above will vary slightly depending on the installation path)

Put the front of the melody, that is, the use of virtual host to open the function;

2. Configure the virtual host in the httpd-vhosts.conf, or you can write the configuration directly in the httpd.conf, but

It is not recommended to do so;

3. Open the httpd-vhosts.conf file and find Namevirutalhost *:80, the meaning of this statement is to make this host

IP address and port number;

4. Key VirtualHost configuration, under Namevirutalhost *:80;

NOTE: When Apache accepts a request, it first defaults to the first virtualhost and then matches the other virtual host

Machine, if there is no match, is the first virtualhost function. Therefore, in httpd.conf, the

<dicrectory/> (This is the default configuration for all directories) and <Direcotry/opt/lampp/htdocs> permissions,

is set to deny from all by default.

5. VirtualHost Configuration Example:

<VirtualHost*:80>

ServerName *

DocumentRoot </opt/lampp/htdocs/guest>

<Directory/opt/lampp/htdocs/guest>

Order Deny,allow

Allow from all

</Direcotry>

<VirtualHost/>

Later, add it in turn to

<virtualhost *:80>

ServerName www.myweb1.com

DocumentRoot </opt/lampp/htdocs/myweb1>

<Directory/opt/lampp/htdocs/myweb1>

Order Deny,allow

Allow from all

</Direcotry>

<VirtualHost/>

Bind multiple domain names or websites using Apache settings

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.