Original: http://dason.blog.51cto.com/658897/505312
Apache Virtual Host configuration (multiple domains access multiple directories)
To facilitate the management of the virtual host, I decided to use one method, that is, to 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:
ServerAdmin dason@sina.com (your mailbox) Documentroot/usr/local/apache2/htdocs/joomla (root directory of this virtual host) ServerName www.abc.com (here is the domain name) errorlog/usr/local/apache2/htdocs/abc/error_log (log) transferlog/usr/local /apache2/htdocs/abc/access_log (log)
ServerAdmin dason@sina.com (your email) documentroot/ Usr/local/apache2/htdocs/bbs (the root directory of this virtual host) ServerName www.bbs.com (domain name here) errorlog/usr/local/apache2/ Htdocs/bbs/error_log (log) Transferlog/usr/local/apache2/htdocs/bbs/access_log (log)
This example adds a www.abc.com host and a www.bbs.com virtual host.
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.
The above describes the Apache virtual host configuration (multiple domain names to access multiple directories), including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.