How Apache binds multiple domain names and sets the default document order

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)

Remove the previous #, 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

(This is the default configuration for all directories) and 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,allowallow from All</direcotry><virtualhost/>

Later, add it in turn to

<virtualhost *:80>servername Www.myweb1.comDocumentRoot </opt/lampp/htdocs/myweb1><directory/opt/ Lampp/htdocs/myweb1>order Deny,allowallow from All</direcotry><virtualhost/>


Set the default document order:

In your Apache, there's a conf folder with a httpd.conf

I found this part in there.

<directory/>  Options followsymlinks  directoryindex index.php index.html  allowoverride  All Order Deny,allow  

This order is index.php and index.html.

You can follow the order of the documents required by your website, pay attention to backup, change the wrong Apache will not start!

How Apache binds multiple domain names and sets the default document order

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.