Apache の設定が間違っています。スクリプトが実行されず、ブラウザがそれをファイルとしてダウンロードしようとしています。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName president.com
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/cgi/
<Directory /var/www/cgi/>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
AddHandler cgi-script .cgi .pl
</Directory>
- スクリプトは
www-data:www-data
権限を持つ が所有し755
、実行できます (+x
)。 - シバン例
#!/usr/bin/perl
。 - エラーログは空の。
答え1
問題が解決しました!
すべて削除しRequire all granted
(Apacvhe 2.4+ のみ)、貼り付けます:
Order allow,deny
allow from all
また、AddHandler cgi-script .cgi .pl
DocumentRootディレクトリの説明に移動します