我正在尝试使用Apache2(Apache/2.4.6(Ubuntu))运行cgi脚本fastcgi_module.这是我设置的虚拟主机
<VirtualHost *:8080>
ServerName cgi.local
DocumentRoot /home/noobeana/CGI
<Directory /home/noobeana/CGI>
AllowOverride All
Order allow,deny
Allow from all
Require all granted
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
SetHandler fastcgi-script
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
这是我创建的用于运行测试()的Perl脚本(正确775'/home/noobeana/CGI/test.pl):
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello there!<br />\n";
Run Code Online (Sandbox Code Playgroud)
Perl可执行文件的路径确实是/usr/bin/perl其他一切看起来很好,但是当我在浏览器中打开http://cgi.local:8080/test.pl时,脚本会永远运行 - 我必须停止Apache强制退出.此外,print正在输出到Apache的错误日志(而不是浏览器),只要脚本正在运行,它就会显示以下多行:
[Fri Feb 07 10:24:54.059738 2014] [:warn] [pid 4708:tid 140365322880896] FastCGI: (dynamic) server "/home/noobeana/CGI/test.pl" started (pid 4771)
Content-type: text/html
Hello there!<br />
[Fri Feb 07 10:24:54.078938 …Run Code Online (Sandbox Code Playgroud)