Linux with Apache one IP multiple sites multiple domain configuration method

  

If there are two domain names, respectively, sos.45it.com and down.45it.com, you need to bind these two domain names to IP is 219.13 .34.32 on the server

1. First, specify the domain name and IP correspondence on the domain name vendor management page.

2.WEB server configuration LAMP environment

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

4. Configure apache #vi httpd.conf Change to ServerName 219.13.34.32:80 and then in the file Add the following:

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 sos.45it.com </VirtualHost> # <VirtualHost 219.13.34.32> ServerAdmin [email protected] DocumentRoot /usr/local/apache/htdocs/upload2 ServerName Down.45it.com </VirtualHost>

Among them: NameVirtualHost 219.13.34.32 is very important, without this, the virtual host can not be established successfully. Here, two virtual hosts with domain names sos.45it.com and down.45it.com are created. The /usr/local/apache/htdocs directory is the page directory that is used to enter the IP directly. The other two are the directories that are accessed when the domain name is entered. Restart the apache service and enter http://sos.45it.com and http://down.45it.com in the browser to access the different websites.

Copyright © Windows knowledge All Rights Reserved