httpd.conf中一旦修改DocumentRoot为其他的目录,则出现Forbidden
的解决方法
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
环境
Linux test.com 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686 i686 i386 GNU/Linux
自带的APACHE
--------------------------------------------
--------------------------------------------
--------------------------------------------
--------------------------------------------
1 关闭 防火强 和 SElinux 进程 ,需要重启服务器
//这个是确保内部没有安全因素的问题下的
httpd.conf中一旦修改DocumentRoot为其他的目录,则出现Forbidden
2、解决方法1 google后,我发现出现上述问题的原因不在于SElinux,而是因为httpd.conf中有
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all ..........修改为Allow from all 后解决
</Directory>
将Deny from all 修改为Allow from all ,就可以访问到我虚拟主机设置文件中的其他目录了!如可访问/var/www,附虚拟主机文件 httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot /var/www
ServerName
DirectoryIndex index.html index.php index.htm
</VirtualHost>
问题2:在主文件httpd.conf中修改为Allow from all 后,apache的默认根目录及/var/www目录的安全性又如何?
3、解决方法2 或者不改变主文件httpd.conf,在虚拟主机文件 httpd-vhosts.conf中,按如下设置也可以访问到该虚拟主机目录
<Directory /var/www>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot /var/www
ServerName
DirectoryIndex index.html index.php index.htm
</VirtualHost>