﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-table-文章分类-Apach</title><link>http://www.blogjava.net/table/category/41689.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 16 Sep 2009 04:53:57 GMT</lastBuildDate><pubDate>Wed, 16 Sep 2009 04:53:57 GMT</pubDate><ttl>60</ttl><item><title>Apache虚拟主机的配置</title><link>http://www.blogjava.net/table/articles/295202.html</link><dc:creator>小卓</dc:creator><author>小卓</author><pubDate>Tue, 15 Sep 2009 11:13:00 GMT</pubDate><guid>http://www.blogjava.net/table/articles/295202.html</guid><wfw:comment>http://www.blogjava.net/table/comments/295202.html</wfw:comment><comments>http://www.blogjava.net/table/articles/295202.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/table/comments/commentRss/295202.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/table/services/trackbacks/295202.html</trackback:ping><description><![CDATA[<p>虚拟主机的配置 </p>
<p><strong>基于IP地址的虚拟主机配置</strong><br />
Listen 80<br />
DocumentRoot /www/example1<br />
ServerName www.example1.com<br />
DocumentRoot /www/example2<br />
ServerName www.example2.org </p>
<p></p>
<p><strong>基于IP和多端口的虚拟主机配置</strong><br />
Listen 172.20.30.40:80<br />
Listen 172.20.30.40:8080<br />
Listen 172.20.30.50:80<br />
Listen 172.20.30.50:8080 </p>
<p>DocumentRoot /www/example1-80<br />
ServerName www.example1.com<br />
DocumentRoot /www/example1-8080<br />
ServerName www.example1.com<br />
DocumentRoot /www/example2-80<br />
ServerName www.example1.org<br />
DocumentRoot /www/example2-8080<br />
ServerName www.example2.org </p>
<p><strong>单个IP地址的服务器上基于域名的虚拟主机配置</strong>：<br />
# Ensure that Apache listens on port 80<br />
Listen 80<br />
# Listen for virtual host requests on all IP addresses<br />
NameVirtualHost *:80<br />
DocumentRoot /www/example1<br />
ServerName www.example1.com<br />
ServerAlias example1.com. *.example1.com<br />
# Other directives here<br />
DocumentRoot /www/example2<br />
ServerName www.example2.org<br />
# Other directives here </p>
<p><strong>在多个IP地址的服务器上配置基于域名的虚拟主机</strong>：<br />
Listen 80<br />
# This is the &#8220;main&#8221; server running on 172.20.30.40<br />
ServerName server.domain.com<br />
DocumentRoot /www/mainserver<br />
# This is the other address<br />
NameVirtualHost 172.20.30.50<br />
DocumentRoot /www/example1<br />
ServerName www.example1.com<br />
# Other directives here &#8230;<br />
DocumentRoot /www/example2<br />
ServerName www.example2.org<br />
# Other directives here &#8230; </p>
<p><strong>在不同的端口上运行不同的站点</strong>：<br />
基于多端口的服务器上配置基于域名的虚拟主机。<br />
Listen 80<br />
Listen 8080<br />
NameVirtualHost 172.20.30.40:80<br />
NameVirtualHost 172.20.30.40:8080<br />
ServerName www.example1.com<br />
DocumentRoot /www/domain-80<br />
ServerName www.example1.com<br />
DocumentRoot /www/domain-8080<br />
ServerName www.example2.org<br />
DocumentRoot /www/otherdomain-80<br />
ServerName www.example2.org<br />
DocumentRoot /www/otherdomain-8080 </p>
<p><strong>基于域名和基于IP的混合虚拟主机的配置</strong>:<br />
Listen 80<br />
NameVirtualHost 172.20.30.40<br />
DocumentRoot /www/example1<br />
ServerName www.example1.com<br />
DocumentRoot /www/example2<br />
ServerName www.example2.org<br />
DocumentRoot /www/example3<br />
ServerName www.example3.net </p>
<p class="post-meta-data"><br />
<br />
eg:<br />
</p>
<font style="background-color: #cce8cf">NameVirtualHost *:8008<br />
&lt;VirtualHost *:8008&gt;<br />
ServerAdmin bchen@jishike.com<br />
DocumentRoot F:/xampp/htdocs/uch2009<br />
ServerName www.table.com<br />
&lt;/VirtualHost&gt;</font>
<img src ="http://www.blogjava.net/table/aggbug/295202.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/table/" target="_blank">小卓</a> 2009-09-15 19:13 <a href="http://www.blogjava.net/table/articles/295202.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>