Linux with Apache one IP multiple domain name to build the virtual host

Source: Internet
Author: User

If there are two domain names, respectively hello.abc.com and play.abc.com, you need to bind these two domain names to
IP is 219.13.34.32 on the server

1. First you need to specify the domain name and IP correspondence in the Domain Name Vendor Management page

2.WEB Server Configuration Good lamp environment

3. Put the corresponding source code into the/usr/local/apache/htdocs directory, respectively named upload and upload2

4. Configure Apache
#vi httpd.conf
Change into
ServerName 219.13.34.32:80
Then add the following to the file:
Namevirtualhost 219.13.34.32
<virtualhost 219.13.34.32>
ServerAdmin[email protected]
Documentroot/usr/local/apache/htdocs
ServerName 219.13.34.32
</VirtualHost>
#
<virtualhost 219.13.34.32>
ServerAdmin[email protected]
Documentroot/usr/local/apache/htdocs/upload
ServerName hello.abc.com
</VirtualHost>
#
<virtualhost 219.13.34.32>
ServerAdmin[email protected]
Documentroot/usr/local/apache/htdocs/upload2
ServerName play.abc.com
</VirtualHost>


Among them: Namevirtualhost 219.13.34.32 is very important, without this, the virtual host is not to establish success.
Here, two domain names are created for hello.abc.com and play.abc.com virtual hosts.
/usr/local/apache/htdocs directory is used to enter the IP directly when the page directory set, the other two, is the input domain
The directory to which the name is accessed.
Restart the Apache service and enter it in the browser
http://hello.abc.com
And
http://play.abc.com
To access the respective web site

Linux with Apache one IP multiple domain name to build the virtual host

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.