Configure Apache to bind multiple domain names

Source: Internet
Author: User

Apache is one of the most widely used HTTP servers. It is fast, stable, and reliable. It can be extended through simple APIs. The PERL/Python interpreter can be compiled into the server, free of charge, and open source code. How can I bind multiple domain names by setting the Apache HTTP. conf file?


Here, we will use the system as centos6.4, the IP address as 112.124.101.177, the domain name as www.aaa.com, and www.bbb.com as an example.

Open the httpd. conf file

Change servername 127.0.0.1 to servername 112.124.101.177

# Modify namevirtualhost * to "namevirtualhost 112.124.101.177"

VI/etc/httpd/CONF/httpd. conf

# <Virtualhost *>

# Serveradmin[Email protected]

# DocumentRoot/www/httpd/html/aaa.com

# Servername aaa.com

# Errorlog logs/aaa.com-error_log

# Customlog logs/aaa.com-access_log common

# </Virtualhost>

# <Virtualhost 112.124.101.177>

DocumentRoot usr/local/www/

Servername 112.124.101.177

# </Virtualhost>

# <Virtualhost 112.124.101.177>

DocumentRoot usr/local/www/aaa.com/

Servername aaa.com

# </Virtualhost>

# <Virtualhost 112.124.101.177>

DocumentRoot usr/local/www/bbb.com/

Servername bbb.com

# </Virtualhost>

Restart Apache to take effect

Service httpd restart

Use the newly bound domain name for access.

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.