【问题标题】:run lxr perl module as scripts under apache 2.4在 apache 2.4 下将 lxr perl 模块作为脚本运行
【发布时间】:2017-04-02 20:19:14
【问题描述】:

在过去的几天里,我一直在努力让它正确,但没有成功。我不是 LAMP 人。

我从默认的 Ubuntu 存储库安装了 Apache 2。以下是/etc/apache2目录的内容:

/etc/apache2$ ls
apache2.conf    conf-enabled  magic           mods-enabled  sites-available
conf-available  envvars       mods-available  ports.conf    sites-e

以下是启用站点的目录的内容:

/etc/apache2/sites-enabled$ ls
000-default.conf

这是我添加到 000-default.conf 中的内容:

Alias "/lxr" "/usr/local/share/lxr"

<Location /lxr>
    allow from all
    Require all granted
</Location>

这里是link 的 perl 模块的内容。

我的问题是:当我访问链接 http://localhost/lxr/source 时,我将它作为文本文件获取,它没有作为脚本执行。

我该如何解决这个问题?

谢谢!

【问题讨论】:

    标签: apache mod-perl mod-perl2 mod-perl-registry


    【解决方案1】:

    您必须首先在您的系统上安装mod_perl。如果您在类似 debian 的发行版中,例如 ubuntu,您可以使用:

    sudo apt-get install libapache2-mod-perl2
    

    然后在 apache 上启用这个模块:

    sudo a2enmod perl
    

    然后重启apache服务器

    sudo service apache2 restart
    

    您还必须添加一些配置,例如:

      PerlModule Apache::Registry
      Alias /cgi-bin/ /usr/lib/cgi-bin
      <Location /cgi-bin>
        SetHandler perl-script
        PerlHandler Apache::Registry
        PerlSendHeader On
        Options +ExecCGI
      </Location>
    

    阅读this article了解更多信息。

    【讨论】:

      猜你喜欢
      • 2017-05-22
      • 1970-01-01
      • 2021-11-07
      • 2012-02-18
      • 2015-03-06
      • 2014-03-05
      • 1970-01-01
      • 2019-04-15
      • 2016-12-28
      相关资源
      最近更新 更多