【问题标题】:Apache: Action directive not activating CGI scriptApache:操作指令未激活 CGI 脚本
【发布时间】:2014-05-27 23:09:54
【问题描述】:

我一直在使用 Apache CGI,并尝试在请求特定文件扩展名时运行 CGI 脚本。

我的 apache2.conf 中有以下内容:

AddHandler handle .html
Action handle /use/lib/cgi-bin/test.pl virtual

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>

因此,当我尝试从我的 DocumentRoot 目录请求一个 html 页面 Hello.html 时,我收到一条错误消息,指出它找不到结合了我的 CGI 脚本位置和请求文件的路径:

找不到

未找到请求的 URL /usr/lib/cgi-bin/test.pl/hello.html 这台服务器。 ryan-virtualbox 端口上的 Apache/2.2.22 (Ubuntu) 服务器 80未找到

为什么我的 CGI 脚本不能运行,为什么这个组合路径显示为 Not Found?

提前致谢。

【问题讨论】:

    标签: apache perl cgi action directive


    【解决方案1】:

    根据mod_actions documentation,cgi-script 是资源的 URL 路径。 所以我猜你的 Action 指令应该被重写:

    Action handle /cgi-bin/test.pl virtual
    

    【讨论】:

    • 太棒了,非常感谢你抓住这个!它就像一个魅力!
    猜你喜欢
    • 2016-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-12
    • 1970-01-01
    相关资源
    最近更新 更多