我有一些使用 perl 的 CGI 脚本,我想让它们在 Apache 上运行。我安装了以下内容:
$ dpkg -l | grep perl | grep apach
ii libapache-session-perl 1.90-1 all modules for keeping persistent user data across HTTP requests
ii libapache2-authcookie-perl 3.19-3 all Perl Authentication and Authorization via cookies
ii libapache2-mod-perl2 2.0.8+httpd24-r1449661-6ubuntu1 i386 Integration of perl with the Apache2 web server
ii libapache2-mod-perl2-dev 2.0.8+httpd24-r1449661-6ubuntu1 all Integration of perl with the Apache2 web server - development files
ii libapache2-mod-perl2-doc 2.0.8+httpd24-r1449661-6ubuntu1 all Integration of perl with the Apache2 web server - documentation
ii libapache2-reload-perl 0.12-2 all module for reloading Perl modules when changed on disk
ii libapache2-request-perl 2.13-2.1 i386 generic Apache request library - Perl modules
ii libapache2-sitecontrol-perl 1.05-1 all perl web site authentication/authorization system
我还/etc/apache2/apache2.conf
添加了类似这样的内容:
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory /usr/lib/cgi-bin/>
Options Indexes FollowSymLinks
Options +ExecCGI
#AllowOverride None
Require all granted
AddHandler cgi-script cgi pl
</Directory>
此后,我在浏览器中获取脚本内容而不是执行它。
提到的脚本具有以下权限:
-rwxr-xr-x 1 root root 30146 mar 7 19:17 /usr/lib/cgi-bin/status.pl
如果我把以下链接
$ ll /etc/apache2/mods-enabled/cgi.load
lrwxrwxrwx 1 root root 26 mar 7 21:40 /etc/apache2/mods-enabled/cgi.load -> ../mods-available/cgi.load
然后我收到错误服务器 500。