linux环境apache多端口配置虚拟主机的方法深入介绍(2)


DocumentRoot "/srv/www/htdocs"
#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# #options
# for more information.
Options None
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
AllowOverride None
# Controls who can get stuff from this server.
Order allow,deny
Allow from all
</Directory>


2、单域名多端口设置

复制代码 代码如下:


<Directory "/srv/www/htdocs/bbs">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<Directory "/srv/www/htdocs/">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
NameVirtualHost   *:80
NameVirtualHost   *:81
<VirtualHost *:80>
  DirectoryIndex  index.html index.php
  ServerName   "www.abc.com "
  DocumentRoot   "/srv/www/htdocs/" 
  </VirtualHost>
<VirtualHost *:81>
  DirectoryIndex   index.php
    ServerName   "www.abc.com:81 "
  DocumentRoot   "/srv/www/htdocs/bbs/" 
  </VirtualHost>


3、多域名多端口设置

复制代码 代码如下:


<Directory "/srv/www/htdocs/btc">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<Directory "/srv/www/htdocs/bbs">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<Directory "/srv/www/htdocs/">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
NameVirtualHost   *:80
NameVirtualHost   *:81
<VirtualHost *:80>
  DirectoryIndex  index.html index.php
  ServerName   "www.abc.com "
  DocumentRoot   "/srv/www/htdocs/" 
  </VirtualHost>
<VirtualHost *:80>
  DirectoryIndex  index.html index.php
  ServerName   "www.btc.com "
  DocumentRoot   "/srv/www/htdocs/btc" 
  </VirtualHost>
<VirtualHost *:81>
  DirectoryIndex   index.php
    ServerName   "www.abc.com:81 "
  DocumentRoot   "/srv/www/htdocs/bbs/" 
  </VirtualHost>


需要注意的问题是,多端口监听,一定要注意listen.conf文件,是否开启了相应端口。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/02b218c066dc6461de28c6a8d92d3768.html