Apache is one of the most widely used HTTP servers. It is fast, stable, and reliable. It can be extended through simple APIs. The PERL/Python interpreter can be compiled into the server, free of charge, and open source code. How can I bind multiple domain names by setting the Apache HTTP. conf file?
Here, we will use the system as centos6.4, the IP address as 112.124.101.177, the domain name as www.aaa.com, and www.bbb.com as an example.
Open the httpd. conf file
Change servername 127.0.0.1 to servername 112.124.101.177
# Modify namevirtualhost * to "namevirtualhost 112.124.101.177"
VI/etc/httpd/CONF/httpd. conf
# <Virtualhost *>
# Serveradmin[Email protected]
# DocumentRoot/www/httpd/html/aaa.com
# Servername aaa.com
# Errorlog logs/aaa.com-error_log
# Customlog logs/aaa.com-access_log common
# </Virtualhost>
# <Virtualhost 112.124.101.177>
DocumentRoot usr/local/www/
Servername 112.124.101.177
# </Virtualhost>
# <Virtualhost 112.124.101.177>
DocumentRoot usr/local/www/aaa.com/
Servername aaa.com
# </Virtualhost>
# <Virtualhost 112.124.101.177>
DocumentRoot usr/local/www/bbb.com/
Servername bbb.com
# </Virtualhost>
Restart Apache to take effect
Service httpd restart
Use the newly bound domain name for access.