apache虚拟主机配置一例
<div class="codetitle"><span><u>复制代码</u></span> 代码如下:</div>
<div class="codebody" id="code17077">
<br>
fivetrees extra # cat httpd-vhosts.conf_bak<br>
#<br>
# Virtual Hosts<br>
#<br>
# If you want to maintain multiple domains/hostnames on your<br>
# machine you can setup VirtualHost containers for them. Most configurations<br>
# use only name-based virtual hosts so the server doesn't need to worry about<br>
# IP addresses. This is indicated by the asterisks in the directives below.<br>
#<br>
# Please see the documentation at<br>
# <URL:http://httpd.apache.org/docs/2.2/vhosts/><br>
# for further details before you try to setup virtual hosts.<br>
#<br>
# You may use the command line option '-S' to verify your virtual host<br>
# configuration.<br>
#<br>
# Use name-based virtual hosting.<br>
#<br>
NameVirtualHost *:80<br>
#NameVirtualHost *:443<br>
#<br>
# VirtualHost example:<br>
# Almost any Apache directive may go into a VirtualHost container.<br>
# The first VirtualHost section is used for all requests that do not<br>
# match a ServerName or ServerAlias in any <VirtualHost> block.<br>
#<br>
#<VirtualHost 192.168.1.66><br>
# RewriteEngine On<br>
# RewriteMap lowercase int:tolower<br>
# RewriteMap vhost txt:/usr/local/apache/conf/host.txt<br>
# RewriteCond %{HTTP_HOST} !^$<br>
# RewriteCond ${lowercase:%{HTTP_HOST}|NONE} ^(.+)$<br>
# RewriteRule ^/(.*...)$ ${vhost:%1...}/$1<br>
#</VirtualHost><br>
<VirtualHost *:80><br>
DocumentRoot /opt/all_dir<br>
ServerName *<br>
</VirtualHost><br>
<VirtualHost *:80><br>
DocumentRoot /opt/1<br>
ServerName 1.com<br>
</VirtualHost><br>
<VirtualHost *:80><br>
DocumentRoot /opt/2<br>
ServerName 2.com<br>
</VirtualHost>
<p>
</p>
<p>
#<VirtualHost *:443><br>
# DocumentRoot /home/hello<br>
# ServerName hello.baidu.com<br>
#</VirtualHost></p>
</div>
<p>
</p>
頁:
[1]