Apache Virtual Host configuration (multiple domains access multiple directories)

Source: Internet
Author: User
Tags web hosting

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.