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