<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OurApache &#187; DocumentRoot</title>
	<atom:link href="http://ourapache.com/archives/tag/documentroot/feed" rel="self" type="application/rss+xml" />
	<link>http://ourapache.com</link>
	<description>我们致力于一个Apache知识的分享网站</description>
	<lastBuildDate>Tue, 13 Apr 2010 05:18:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>apache core段的DocumentRoot与访问权限</title>
		<link>http://ourapache.com/archives/132</link>
		<comments>http://ourapache.com/archives/132#comments</comments>
		<pubDate>Thu, 12 Feb 2009 07:00:18 +0000</pubDate>
		<dc:creator>OurApache</dc:creator>
				<category><![CDATA[Apache解错方案]]></category>
		<category><![CDATA[DocumentRoot]]></category>
		<category><![CDATA[权限]]></category>

		<guid isPermaLink="false">http://www.ourapache.com/?p=132</guid>
		<description><![CDATA[设置Apache的虚拟主机时的路径权限要仔细 ]]></description>
			<content:encoded><![CDATA[<p align="left">Tips:</p>
<p>设置Apache的虚拟主机时的路径权限要仔细</p>
<p align="left">虚拟主机段配置如下：</p>
<blockquote>
<p align="left">NameVirtualHost *:80<br />
&lt;VirtualHost *:80&gt; <br />
        ServerAdmin zhao@sst.cn <br />
        <a href="http://ourapache.com/archives/tag/documentroot" class="st_tag internal_tag" rel="tag" title="标签 DocumentRoot 下的日志">DocumentRoot</a> /somewhere/ww1 <br />
        ServerName ww1.sst.cn <br />
        ErrorLog logs/ww1.sst.cn-error_log <br />
        CustomLog logs/ww1.sst.cn-access_log common<br />
&lt;/VirtualHost&gt;<br />
&lt;VirtualHost *:80&gt; <br />
        ServerName ww2.sst.cn <br />
        DocumentRoot /somewhere/ww2<br />
&lt;/VirtualHost&gt;</p>
</blockquote>
<p>当apache core段的DocumentRoot 值设为/somewhere/ww1时，</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="284" valign="top">
<p align="left">访问ww1.sst.cn</p>
</td>
<td width="284" valign="top">
<p align="left">通过</p>
</td>
</tr>
<tr>
<td width="284" valign="top">
<p align="left">访问ww2.sst.cn</p>
</td>
<td width="284" valign="top">
<p align="left">Forbiddden</p>
</td>
</tr>
</tbody>
</table>
<p align="left">当apache core段的DocumentRoot 值设为/somewhere时，</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="284" valign="top">
<p align="left">访问ww1.sst.cn</p>
</td>
<td width="284" valign="top">
<p align="left">通过</p>
</td>
</tr>
<tr>
<td width="284" valign="top">
<p align="left">访问ww2.sst.cn</p>
</td>
<td width="284" valign="top">
<p align="left">通过</p>
</td>
</tr>
</tbody>
</table>
<p align="left">  分析下来禁止访问产生的原因，是httpd.conf中对相应Directory段没有增加定义，如上例，如果核心DocumentRoot（/somewhere/ww1）不是接下来定义的虚拟主机中的DocumentRoot（/somewhere/ww2）的父目录，则需要增加定义虚拟主机自有的DocumentRoot（/somewhere/ww2）其相应的Directory定义：</p>
<blockquote>
<p align="left">&lt;Directory /somewhere/ww2&gt;</p>
<p align="left">    Options FollowSymLinks</p>
<p align="left">    AllowOverride None</p>
<p align="left">&lt;/Directory&gt;</p>
</blockquote>
<p align="left">自己提醒自己千万要仔细，吃了两次亏，还是忘记。</p>
<h3  class="related_post_title">无相关文章，以下随机显示</h3><ul class="related_post"><li>2010年03月9号 -- <a href="http://ourapache.com/archives/316" title="htaccess二级目录重写找不到路径">htaccess二级目录重写找不到路径</a></li><li>2009年08月13号 -- <a href="http://ourapache.com/archives/275" title="Apache+Django性能优化之mod_wsgi篇">Apache+Django性能优化之mod_wsgi篇</a></li><li>2009年02月7号 -- <a href="http://ourapache.com/archives/85" title="apache之404错误页面">apache之404错误页面</a></li><li>2009年03月30号 -- <a href="http://ourapache.com/archives/232" title="Apache Prefork和Worker模式的性能比较测试">Apache Prefork和Worker模式的性能比较测试</a></li><li>2009年08月13号 -- <a href="http://ourapache.com/archives/286" title="linux下查看nginx，apache，mysql，php的编译参数">linux下查看nginx，apache，mysql，php的编译参数</a></li><li>2009年06月14号 -- <a href="http://ourapache.com/archives/255" title="常见的rewrite规则大全">常见的rewrite规则大全</a></li><li>2009年01月6号 -- <a href="http://ourapache.com/archives/25" title="Apache服务器使用.htaccess实现图片防盗链方法教程">Apache服务器使用.htaccess实现图片防盗链方法教程</a></li><li>2009年02月19号 -- <a href="http://ourapache.com/archives/151" title="IE环境下的安全警告汇总收藏">IE环境下的安全警告汇总收藏</a></li><li>2009年01月6号 -- <a href="http://ourapache.com/archives/35" title="不再为Apache进程淤积、耗尽内存而困扰">不再为Apache进程淤积、耗尽内存而困扰</a></li><li>2009年06月14号 -- <a href="http://ourapache.com/archives/253" title="Apache自动添加地址末尾的斜线">Apache自动添加地址末尾的斜线</a></li></ul>
	标签：<a href="http://ourapache.com/archives/category/debug" title="Apache解错方案" rel="tag">Apache解错方案</a>, <a href="http://ourapache.com/archives/tag/documentroot" title="DocumentRoot" rel="tag">DocumentRoot</a>, <a href="http://ourapache.com/archives/tag/%e6%9d%83%e9%99%90" title="权限" rel="tag">权限</a><br />
]]></content:encoded>
			<wfw:commentRss>http://ourapache.com/archives/132/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

