我正在尝试创建一个带有 index.cgi 的网站(如果可用),将其作为内容提供。在 /etc/apache2/sites-enabled/000-default 中,我有:
DirectoryIndex index.cgi index.html
DocumentRoot /home/jonathan/mirror
DocumentRoot 被赋予 +ExecCGI:
Options +ExecCGI Indexes FollowSymLinks MultiViews
当我访问 localhost 时,它会显示 index.cgi 的源代码:
#!/usr/bin/perl
if ($ENV{"HTTP_HOST"} =~ /^www\./)
{
print "Status: 301 Moved Permanently\n";
print "Location: http://" . substr($ENV{"HTTP_HOST"}, 4) . "\n\n";
}
if ($ENV{"HTTP_HOST"} =~ /^fan/ or $ENV{"HTTP_HOST"} =~ /jonathanscommunity/)
{
print "Status: 301 Moved Permanently\n";
print "Location: http://www.facebook.com/pages/CJS-Hayward/9506801167\n\n";
...
我需要做什么才能执行 /index.cgi 并给出其结果?