【问题标题】:Apache2 Returns 404 on Perl ScriptApache2 在 Perl 脚本上返回 404
【发布时间】:2013-04-19 17:05:40
【问题描述】:

[已解决]

在设法让服务器抛出 500 次后,我不得不重新定位线路; 到 .pl 脚本中的不同位置。

;-)

我通过 SO:Why does my Perl CGI program return a server error?找到了这篇文章

这与我目前在运行 A2 的 Ubuntu 12.04.02 中遇到的问题相同,但在 /etc/apache2/sites-available 中进行看起来正确的设置更改并没有产生任何积极影响。

=> 在 perl 脚本中(就在对 perl 解释器的调用下方)脚本中,我在从浏览器运行时遇到问题, 功能 VIA CLI;

 print "Content-type: text/plain\n\n";
 print STDERR "OK so far\n";
 print "Succeeded.";

=> 这个服务器在这个配置点上是非常基础的,并且只打算托管 1 个网站。此时尚未分配域,我只是通过 LAN IP 10.0.0.50 访问它,我认为这应该不是问题?

=> 我的文档根是/var/www => cg-bin 位于:/var/www/cgi-bin

=> 目前 /etc/apache2/sites-available/default 正在使用以下关于 ScriptAlias 的参数;

   ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

=> 我已将上述设置为以下,但服务器仍然返回 404;

ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin/">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
</Directory>

=> /var/log/apache2/error.log 提供以下内容:

[Thu Apr 18 23:06:22 2013] [error] [client 10.0.0.10] script not found or unable to stat: /usr/lib/cgi-bin/acctmanager.pl
[Thu Apr 18 23:07:45 2013] [notice] caught SIGTERM, shutting down
[Thu Apr 18 23:07:46 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.6 with Suhosin-Patch configured -- resuming normal operations

=> ** /etc/apache2/sites-available/default ** 的顶部显示为;

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory /var/www>
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory

如果有人对我的错误有所了解,我将非常感谢您的时间和投入。

谢谢

最好的问候

【问题讨论】:

  • 我现在在 /etc/apache2/sites-available/default 中进行了更改,现在使服务器返回 500。 /var/log/apache2/error.log: [Fri Apr 19 10:56:32 2013] [error] [client 10.0.0.10] (2)No such file or directory: exec of '/var/www/cgi- bin/acctmanager.pl' 失败 [Fri Apr 19 10:56:32 2013] [error] [client 10.0.0.10] 脚本头过早结束:acctmanager.pl
  • 在 Stack Overflow,您不会将 SOLVED 添加到问题的标题中。相反,您选择您认为最能解决问题的答案分数下方的复选标记。
  • 对于我将 SOLVED 放在 TITLE 中的错误,我深表歉意
  • 顺便说一句:我没有收到任何回复,我自己解决了这个问题。因此,您的要求:相反,您选择您认为最能解决您的问题的答案分数下方的复选标记
  • 那么您应该将您的解决方案写成答案并将其标记为已接受,以便下一个遇到您问题的人可以从中受益。

标签: perl apache2 http-status-code-404


【解决方案1】:

我相信您对 script/dir 文件夹具有 u+x 权限,并且该脚本位于 ScriptAlias 目录中,请再次检查此链接以查看您是否错过了任何配置。 -

【讨论】:

  • 你说得对,我确实发现问题与文件权限有关,谢谢..
猜你喜欢
  • 2017-03-31
  • 2018-02-11
  • 2022-01-14
  • 1970-01-01
  • 2019-05-21
  • 2011-08-02
  • 2012-01-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多