我的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
)。答案 0 :(得分:1)
问题解决了!
我删除了所有Require all granted
(仅适用于Apacvhe 2.4+)并粘贴:
Order allow,deny
allow from all
此外,我将AddHandler cgi-script .cgi .pl
移至DocumentRoot目录说明