How does apache bind multiple domain names?

Source: Internet
Author: User

We know that many webmasters put N sites on one server, so we must bind one server to multiple domain names. Let me introduce them below.

Open http. conf
1. Change ServerName 127.0.0.1 to ServerName 72.167.11.30.
2, # modify NameVirtualHost * to "NameVirtualHost 72.167.11.30"
3. There is a VM format at the end of the file,

The Code is as follows: Copy code
# <VirtualHost *>
# ServerAdmin [email] admin@minidx.com [/email]
# DocumentRoot/www/httpd/html/minidx.com
# ServerName minidx.com
# ErrorLog logs/minidx.com-error_log
# CustomLog logs/minidx.com-access_log common
# </VirtualHost>


Simple addition:

The Code is as follows: Copy code

<VirtualHost *. 80>
DocumentRoot usr/local/www/
ServerName Domain Name
</VirtualHost>

<VirtualHost *. 80>
DocumentRoot usr/local/www/minidx.com/
ServerName Domain Name
</VirtualHost>

I found that something called "ServerAlias" can be used.

 

The Code is as follows: Copy code
<VirtualHost *. 80>
ServerName Domain Name
ServerAlias domain name 1 domain name 2
DocumentRoot "/www/o135 /"
</VirtualHost>

If you want to bind multiple domain names to a website, we can use a space in the middle of "ServerAlias domain name 1 domain name 2.

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.