我的ubuntu版本是15.04。我遵循了配置服务器的步骤:
sudo apt-get install apache2sudo apt-get install libapache2-mod-perl2sudo apt-get install perl-debugsudo apt-get install libapache2-mod-perl2-devsudo apt-get install libapache2-request-perl libdatetime-perlmkdir /var/www/cgi-binnano perltest.pl
#!/usr/bin/perl -w打印"Content-type: test/html\r\n\r\n";打印"Hello!\n nJust test. \n";for ($i=0;$i<10;$i++) { print $i.“;}chmod a+x perltest.pl/etc/apache2/sites-available/000-default.conf
# ServerName指令设置服务器用于标识自身的请求方案、主机名和端口。这在创建#重定向URL时使用。在虚拟主机的上下文中,ServerName #指定什么主机名必须出现在请求的主机:报头中,以匹配这个虚拟主机。对于默认的虚拟主机(此文件),这个#值不是决定性的,因为它被用作最后的主机,不管如何。但是,您必须显式地将其设置为任何进一步的虚拟主机。#ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/ #现有日志级别: trace8、.、trace1、调试、信息、通知、警告、#错误、crit、警报、emerg。#还可以为特定的#模块配置日志级别,例如#LogLevel ssl:warn < PerlResponseHandler ~“。( pl )$”>PerlResponseHandler perl-PerlResponseHandler ModPerl::PerlRun Options +ExecCGI PerlSendHeader On < /Files> ScriptAlias / cgi /var/www/cgi/< Directory /var/www/cgi/bin/> AllowOverride无选项ExecCGI -MultiViews +SymLinksIfOwnerMatch cgi-脚本cgi命令允许,拒绝“从所有ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log组合#”到conf可用/的大多数配置文件,这些配置文件在全局级别上已启用或禁用,因此可以只为一个特定的虚拟主机包括一行。例如,下面的#行仅在此主机被"a2disconf“全局禁用后才启用它的CGI配置。#包括conf-available/serve cgi-bin.conf# vim: syntax=apache ts=4 sw=4 sts=4 sr/etc/apache2/sites-available/default-ssl.conf文件是这里(第5-11行)/etc/apache2/sites-enabled/000-default.conf文件是这里(第12-37行)/etc/apache2/apache2.conf文件是这里(行- (54-78))但是,浏览器下载文件。我无法理解这些问题。请帮帮忙。
发布于 2016-07-27 08:14:19
print "Content-type: test/html\r\n\r\n";
^
Here is your problem应该是print "Content-type: text/html\r\n\r\n";
通过以下命令在计算机中根目录并重新启动apache服务器
/etc/init.d/apache2 restart
https://stackoverflow.com/questions/38607344
复制相似问题