Apache Virtual Host configuration (multiple domain names to access multiple directories) in order to facilitate the management of the virtual host, I decided to use one method, that is, modify the httpd-vhosts.conf file. The first step is to make the extension file httpd-vhosts.conf effective:
1. Open apache/conf/httpd.conf File
2. Find # Include Conf/extra/httpd-vhosts.conf
3. Remove the previous comment sign #
4. Open apache/conf/extra/httpd-vhosts.conf
5. Add the above multi-port or multi-domain code (this is the case with multi-domain names):
6. Open apache2/conf/extra/httpd-vhost.conf
Add into the bottom:
Example:
<virtualhost 192.168.1.1:80>
ServerAdmin[email protected](Your e-mail)
Documentroot/usr/local/apache2/htdocs/joomla (root directory of this virtual host)
ServerNamewww.abc.com(the domain name here)
Errorlog/usr/local/apache2/htdocs/abc/error_log (log)
Transferlog/usr/local/apache2/htdocs/abc/access_log (log)
</virtualhost><virtualhost 192.168.1.1:80>
ServerAdmin[email protected](Your e-mail)
Documentroot/usr/local/apache2/htdocs/bbs (root directory of this virtual host)
ServerNamewww.bbs.com(the domain name here)
Errorlog/usr/local/apache2/htdocs/bbs/error_log (log)
Transferlog/usr/local/apache2/htdocs/bbs/access_log (log)
</VirtualHost>
This example adds awww.abc.comThe host and Awww.bbs.comof virtual hosts. NOTE: The Apache service must be restarted after the virtual host has been added. If it is a server, direct access to the domain name will be able to access the corresponding web hosting site. If you are doing a test environment (I am the test environment), the host file of the real machine can be modified, so that the test domain name and the server (virtual machine) IP Address Association, so that the real machine access to the domain name, the light into the corresponding virtual host site when the success.
This article originates from: http://dason.blog.51cto.com/658897/505312
Apache Virtual Host configuration (multiple domains access multiple directories)