CGI 脚本在 Mac 上以纯文本而不是网页形式运行



我按照这篇文章运行了 test.pl 文件:

 http://editrocket.com/articles/perl_apache_mac.html

我还在 httpd.conf 文件中做了一些配置,这是我所做工作的快照:

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
.....
#
# "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Require all granted
</Directory>
...
    #
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl

就像 apache 服务器在我运行时正在运行 http://localhost 一样,我得到一个"它有效!"页面。我应该怎么做才能让.cgi运行?

所以。我深入研究了更多内容,并重新访问了更多的堆栈溢出帖子。事实证明,我需要取消注释配置文件中的行:

  LoadModule cgi_module libexec/apache2/mod_cgi.so

这在我遵循的教程中没有提到。感谢之前的所有评论

最新更新