0
我的ubuntu版本是15.04。 我跟着用於配置服務器的步驟:瀏覽器嘗試下載.pl文件而不是執行它 - apache2,perl cgi腳本,ubuntu
- sudo易於得到安裝的Apache2
- 命令和apt-get安裝中的libapache2-MOD-perl2
- 命令和apt-get安裝Perl的調試
- 須藤apt-get的安裝中的libapache2-MOD-perl2-dev的
- 命令和apt-get安裝中的libapache2請求-perl的libdatetime-perl的
- 的mkdir /無功/網絡/ cgi-bin目錄
納米perltest.pl
#!/usr/bin/perl -w print "Content-type: test/html\r\n\r\n"; print "Hello there!<br/>\nJust Testing. <br/>\n"; for ($i=0; $i<10;$i++) { print $i."<br/>"; }
CHMOD一個+ X perltest.pl
編輯/etc/apache2/sites-available/000-default.conf
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin [email protected] DocumentRoot /var/www/ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn < Files ~ "\.(pl|cgi)$"> SetHandler perl-script PerlResponseHandler ModPerl::PerlRun Options +ExecCGI PerlSendHeader On < /Files> ScriptAlias /cgi-bin/ /var/www/cgi-bin/ < Directory /var/www/cgi-bin/> AllowOverride None Options ExecCGI -MultiViews +SymLinksIfOwnerMatch AddHandler cgi-script cgi pl Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
/etc/apache2/sites-available/default-ssl.conf文件是here(line 5-11)
- /etc/apache2/sites-enabled/000-default.conf文件是here(線12-37)
- 添加行納米/etc/apache2/apache2.conf中的文件是here(線 - (54-78))
- 在瀏覽器中,命中http://127.0.0.1/cgi-bin/perltest.pl
但是,瀏覽器下載文件。 我無法理解這些問題。請幫忙。