403获取图像时出错,但没有其他资源

时间:2013-02-24 05:24:01

标签: php xampp http-status-code-403

我在ubuntu(/opt/lampp)上安装了xampp,我在/home/mustafa/public_html创建了一个public_html文件夹(我认为它是一个符号链接,我是linux的新手)我把我的php文件和其他在public_html文件夹中的资源,问题是当我想得到像图像这样的东西我得到403错误(禁止访问)但其他文件就像PHP,CSS,JS文件一样。问题是什么?我该怎么办?

更新

终端中ls -l /home/mustafa/public_html/templates/assets/images/的输出:

total 8
-rwxrwx--- 1 mustafa mustafa 4638 Feb 17 22:06 hbg.png

ls -l /home/mustafa/public_html/templates/assets/style/

total 16
-rw-rw-r-- 1 mustafa mustafa 1571 Feb 23 13:06 style.css
-rw-rw-r-- 1 mustafa mustafa 1567 Feb 23 13:06 style.css~
-rw-rw-r-- 1 mustafa mustafa  689 Feb 23 18:07 style_I.css
-rw-rw-r-- 1 mustafa mustafa  691 Feb 23 17:58 style_I.css~

我将图片移动到其他目录,发现我无法访问public_html和子目录中的任何图像

2 个答案:

答案 0 :(得分:1)

在我看来,其他群组无法根据您的ls -l输出访问图片。

当您的css文件为rwxrwx---时,它显示rw-rw-r--

您应该chmod 664您的图片,以便它们与您的css文件匹配,或chown apache所有文件(假设apache以apache运行)并查看是否有效。

要检查哪个进程正在运行apache,您可以使用ps aux | grep httpd

[user@host ~]$ ps aux | grep httpd
root      6407  0.0  0.3  11204  3288 ?        Ss   09:06   0:00 /usr/sbin/httpd
apache    6409  0.0  0.2  11340  2952 ?        S    09:06   0:00 /usr/sbin/httpd
apache    6410  0.0  0.2  11340  2948 ?        S    09:06   0:00 /usr/sbin/httpd
apache    6411  0.0  0.2  11340  2940 ?        S    09:06   0:00 /usr/sbin/httpd
apache    6412  0.0  0.2  11340  2948 ?        S    09:06   0:00 /usr/sbin/httpd
apache    6413  0.0  0.2  11340  2948 ?        S    09:06   0:00 /usr/sbin/httpd
apache    6414  0.0  0.2  11340  2948 ?        S    09:06   0:00 /usr/sbin/httpd
apache    6415  0.0  0.2  11340  2948 ?        S    09:06   0:00 /usr/sbin/httpd
apache    6416  0.0  0.2  11340  2948 ?        S    09:06   0:00 /usr/sbin/httpd
root      6426  0.0  0.0   5500   720 pts/1    S+   09:14   0:00 grep httpd

答案 1 :(得分:0)

如果您使用的是共享主机方案 - 请确保plesk中的设置没有启用限制并发IP连接并设置为特定数量。我打开了这个并设置为10并发连接(只是测试这个选项),我会得到一定数量的文件 - 其余的将被禁止,因此一些脚本无法执行等等。

Linux托管可能也是如此。

所以那些brothas测试和玩共享主机 - 转到Web服务器设置 - >通过IIS动态IP限制防止DoS攻击 - 并确保禁用所有内容。