One Apache host is bound to multiple domain names and virtual hosts.

Source: Internet
Author: User
Tags website domain names

Today I studied how to bind multiple domain names to a single host in Apache and use port 80. To put it bluntly, multiple websites are run on one host, and the website domain names are all port 80.

The specific method is as follows:

1. Go to the Apache conf directory and find httpd. conf. For example, my directory is c: \ Program Files (x86) \ apache group \ apache2 \ conf.

2. Open httpd. conf in notepad or another text editor and find the line # namevirtualhost *: 80 (or search for namevirtualhost ).

3. Read the following comments, including the notes for namevirtualhost and virtualhost.

4. Add the following information to your httpd. conf file:

NameVirtualHost 219.133.61.226:80<VirtualHost 219.133.61.226:80>     ServerAdmin web1@web1.com     DocumentRoot /usr/local/apache2/htdocs1     ServerName www.web1.com     ErrorLog logs/web1.com-error_log     CustomLog logs/web1.com-access_log common</VirtualHost><VirtualHost 219.133.61.226:80>     ServerAdmin web2@web2.com     DocumentRoot /usr/local/apache2/htdocs2     ServerName www.web2.com     ErrorLog logs/web2.com-error_log     CustomLog logs/web2.com-access_log common</VirtualHost>

Here namevirtualhost is the IP address and port number of your host.

<VirtualHost 219.133.61.226:80>
</VirtualHost>

The above indicates a virtual host. Here, you need to note that servername is your domain name. In this way, you can configure multiple domain names and bind them to port 80. Please try it.

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.