CentOS binds multiple domain names

Source: Internet
Author: User

Using the Aliyun host, run the centos6.4 64-bit system and bind the domain name after installing the lamp environment. The configuration file is as follows:

<virtualhost *:80>documentroot/var/www/htmlservername 120.24.54.xxx</virtualhost><virtualhost *:80 >    documentroot/var/www/html/domain1    ServerName domain.com    serveralias *.domain.com</ Virtualhost><virtualhost *:80>    documentroot/var/www/html/domain2    ServerName domain.com    Serveralias *.domain.com</virtualhost>
You can then access the site to the/var/www/html/domain1 directory via www.domain1.com, but the www.domain1.com access is also point/var120.24 . A. XXX Access also points to the DOMAI1 directory, and the configuration file has not moved anywhere else. I want to point to the HTML directory via IP access and point to the corresponding directory through the domain name access.

You have found the answer by viewing the official documentation:
# Ensure that Apache listens on port 80
Listen 80

 for Virtual  *:<virtualhost *: >/www/example1servername www.example.com# Other directiveshere </virtualhost><virtualhost *:>/www/  Example2servername www.example.org# Other directiveshere </VirtualHost>

Must be turned NameVirtualHost *:80 on, otherwise no matter how many domain names are bound, all will point to the first virtualhost DocumentRoot

CentOS binds multiple domain names

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.