How to configure the multi-site virtual host of apache in Linux

Source: Internet
Author: User
This article describes how to configure Apache multi-port and multi-site. If you need it, we recommend that you take a look. If you have two domain names, which are pai.linuxdown.com and tool.linuxdown.com, You need to bind both domain names
The IP address is on the server 219.13.34.32.

1. First, you must specify the correspondence between the domain name and IP address on the domain name supplier management page.

2. Configure the LAMP environment on the WEB Server

3. Put the corresponding source code in the/usr/local/apache/htdocs directory and name them upload and upload2 respectively.

4. Configure apache
# Vi httpd. conf
Change
ServerName 219.13.34.32: 80
Add the following content to the file:
NameVirtualHost 219.13.34.32
 
ServerAdmin afd@dsf.com
DocumentRoot/usr/local/apache/htdocs
ServerName 219.13.34.32



ServerAdmin dsf@af.com
DocumentRoot/usr/local/apache/htdocs/upload
ServerName pai.linuxdown.com



ServerAdmin adf@fda.com
DocumentRoot/usr/local/apache/htdocs/upload2
ServerName tool.linuxdown.com


Among them: NameVirtualHost 219.13.34.32 is very important. Without this, the virtual host cannot be established successfully.
Here, two virtual hosts with the domain names of desk.linuxdown.com and tool.linuxdown.com are created.
The/usr/local/apache/htdocs directory is the page directory set when the IP address is entered directly. The other two are the input fields.
The directory to be accessed.
Restart the apache service and enter
Http://desk.linuxdown.com and http://tool.linuxdown.com
You can access different websites.
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.