Apache設定問題?為什麼Perl腳本無法執行-瀏覽器下載腳本

Apache設定問題?為什麼Perl腳本無法執行-瀏覽器下載腳本

我的 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>
  1. 腳本擁有www-data:www-data權限755並且可以執行 ( +x)。
  2. 舍邦例如#!/usr/bin/perl
  3. 錯誤日誌是空的

答案1

問題解決了!

我刪除所有內容Require all granted(僅適用於 Apacvhe 2.4+)並貼上:

Order allow,deny
allow from all

我還移動AddHandler cgi-script .cgi .pl到 DocumentRoot 目錄描述

相關內容