Apache virtual host configuration (multiple domain names access multiple directories), apache virtual host_PHP tutorial

WBOY
Release: 2016-07-12 09:01:05
Original
899 people have browsed it

Apache virtual host configuration (multiple domain names access multiple directories), apache virtual host

Original text: http://dason.blog.51cto.com/658897/505312

Apache virtual host configuration (multiple domain names accessing multiple directories)

In order to facilitate the management of virtual hosts, I decided to use a method, which is to modify the httpd-vhosts.conf file. The first step is to make the extension file httpd-vhosts.conf effective:
1. Open the apache/conf/httpd.conf file
2. Find # Include conf/extra/httpd-vhosts.conf
3 . Remove the preceding comment symbol #
4. Open apache/conf/extra/httpd-vhosts.conf
5. Add the above multi-port or multi-domain name code (here, take multiple domain names as an example):
6. Open apache2/conf/extra/httpd-vhost.conf
and add the following:
Example:
<VirtualHost 192.168.1.1:80>
    ServerAdmin dason@sina.com (你的邮箱)
    DocumentRoot /usr/local/apache2/htdocs/Joomla(此虚拟主机的根目录)
    ServerName www.abc.com(此处为域名)
    ErrorLog /usr/local/apache2/htdocs/abc/error_log (日志)
    TransferLog /usr/local/apache2/htdocs/abc/access_log (日志)
</VirtualHost>
<VirtualHost 192.168.1.1:80>
    ServerAdmin dason@sina.com (你的邮箱)
    DocumentRoot /usr/local/apache2/htdocs/bbs (此虚拟主机的根目录)
    ServerName www.bbs.com (此处为域名)
    ErrorLog /usr/local/apache2/htdocs/bbs/error_log (日志)
    TransferLog /usr/local/apache2/htdocs/bbs/access_log (日志)
</VirtualHost>
Copy after login
This example adds a www.abc.com host and a www.bbs.com virtual host. Note: After adding a virtual host, the apache service must be restarted. If it is a server, you can access the corresponding virtual host website by directly accessing the domain name. If it is a test environment (mine is a test environment), you can modify the hosts file of the real machine so that the test domain name is associated with the server (virtual machine) IP address. In this way, accessing the domain name on the real machine will be redirected to the corresponding virtual machine. It is successful when hosting the website.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1090105.htmlTechArticleApache virtual host configuration (multiple domain names access multiple directories), apache virtual host original text: http://dason .blog.51cto.com/658897/505312 Apache virtual host configuration (multiple domain names access multiple...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template