zhengsenlin888 发表于 2011-12-21 08:44

根据我需要配置apache虚拟主机

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