English 中文(简体)
无法访问本地主机-403被禁止
原标题:Unable to access localhost - 403 forbidden

I am able to access some areas of the localhost but cannot access others for example,

  • 我可以访问localhost/index.phplocalhost:somefolder/

  • 但不是本地主机/某个文件夹/另一个文件夹

我也无法在php的另一个文件夹包含中的任何文件,因为它说无法打开流:没有这样的文件或目录

我有chmod-R 755 www,但仍然无法访问子目录

可能的原因是什么?

最佳回答

检查该机器上是否运行了SELinux。然后对可以查看的目录和不能查看的目录执行ls-alZ。如果启用了SELinux,则无法查看的目录的安全组可能未设置为http安全组。我认为这应该是system_u:object_r:httpd_sys_content_t的效果。

检查您的系统是否在/etc/SELinux/config中启用了SELinux。如果是,请转到您遇到问题的目录,键入:chcon-Rv-type=httpd_sys_content_t<;目录名>

问题回答

如果你的文件夹中没有index.html(或index.php),如果不将目录公开,你就无法访问它们。默认情况下,这应该是禁用的,但对于您的包含问题,我需要一些代码和目录树。





相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...