Apache 给出 403 禁止错误 [英] Apache giving 403 forbidden errors

查看:47
本文介绍了Apache 给出 403 禁止错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我之前设置了两个虚拟主机,它们运行良好.它们都包含简单的 Web 项目,并且可以在浏览器中使用 http://project1http://project2.

Ok, so i've previously set up two virtual hosts and they are working cool. they both house simple web projects and work fine with http://project1 and http://project2 in the browser.

无论如何,我是来添加另一个虚拟主机的.我用 127.0.0.1 project3 编辑了/etc/hosts 文件,并通过复制和粘贴 project2 的先前条目并编辑文件路径来更新 httpd-vhosts.conf 文件.

Anyway, I've come to add another vhost. I edited the /etc/hosts file with 127.0.0.1 project3 and also updated the httpd-vhosts.conf file by copy and pasting the previous entries for project2 and editing the file path.

我已经检查了所有文件和文件夹的权限(实际上我是从 project2 复制粘贴的),并在 index.php 文件中简单地添加了一条hello world"消息.

I've checked all the file and folder permissions (in fact I copied and pasted from project2) and simply put a "hello world" message in the index.php file.

我在访问 http://project3

这是为什么,我只能弄清楚我错过了什么步骤,因为一切似乎都设置正确.

Why is this, I just can figure out what step I've missed as everything seems to be set up correct.

推荐答案

检查:

  • Apache 可以物理访问文件(运行 apache 的用户,可能是 www-data 或 apache,可以访问文件系统中的文件)
  • Apache 可以列出文件夹的内容(读取权限)
  • Apache 对该文件夹有一个允许"指令./var/www/应该有一个,例如您可以检查默认虚拟主机.

此外,您可以查看 error.log 文件(通常位于 /var/log/apache2/error.log),该文件将准确描述您收到 403 错误的原因.

Additionally, you can look at the error.log file (usually located at /var/log/apache2/error.log) which will describe why you get the 403 error exactly.

最后,您可能需要重新启动 apache,以确保应用所有配置.这通常可以通过 /etc/init.d/apache2 restart 来完成.在某些系统上,该脚本将被称为 httpd.想清楚就行了.

Finally, you may want to restart apache, just to be sure all that configuration is applied. This can be generally done with /etc/init.d/apache2 restart. On some system, the script will be called httpd. Just figure out.

这篇关于Apache 给出 403 禁止错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆