当它肯定存在时找不到URL错误

时间:2012-05-30 04:37:43

标签: html linux url cgi

我在服务器[Linux OS]上运行了小型CGI脚本。以下是脚本输出的一部分..

<tr><td valign="center">Lol</td><td valign="center">10112</td><td><a 
href="/home/pathtopdf/abc.pdf">abc.pdf</a></td></tr>

但是当我点击这个abc.pdf超链接时,浏览器显示错误消息:URL /home/pathtopdf/abc.pdf was not found on the server.,而pdf和路径肯定在那里,路径[包括pdf]中的所有文件和文件夹都有完全权限。

我的服务器位置是@ /srv/www/srv/www/cgi-bin中的脚本,但是当我将链接发送到pdf时,如下所示

<tr><td valign="center">Lol</td><td valign="center">10112</td><td><a 
href="/srv/www/for_html/abc.pdf">abc.pdf</a></td></tr>

错误消息为The requested URL '/srv/www/for_html/abc.pdf' resolves to a file which is marked executable but is not a CGI file; retrieving it is forbidden.再次允许存档文件。

可能是什么问题?

2 个答案:

答案 0 :(得分:3)

您的问题是您尝试在webroot之外请求文件。所以通过点击它,浏览器真的要求

http://example.com/home/pathtopdf/abc.pdf

/home/pathtopdf/abc.pdf

您可以编辑您的apache配置文件,并在子域下将该虚拟主机添加到该目录(比如下载)

答案 1 :(得分:0)

编辑后,我假设您正在使用file://协议,直接在服务器上。我想说只是从.pdf的文件权限中删除可执行位。从shell运行:

chmod -x /srv/www/for_html/abc.pdf