我一直在努力让它工作,但无论我做什么,我都无法在我的虚拟目录的 cgi-bin 中执行 .pl 文件。在过去的 4 个小时里,我一直在寻找解决方案,并尝试了我遇到的所有问题,但没有什么对我有用。Perl 文件在我的默认站点上运行得很好,但对我的虚拟主机来说却不是。我的 Apache2 配置中唯一修改过的文件是 /etc/apache2/sites-available/default 文件,目前如下(站点名除外):
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/cgi-bin>
Options +ExecCGI
AllowOverride All
AddHandler cgi-script cgi pl
Order allow,deny
allow from all
</Directory>
# ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
# <Directory "/usr/lib/cgi-bin">
# AllowOverride All
# Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# Order allow,deny
# Allow from all
# </Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAlias subdom.mysite.com
DocumentRoot /var/www/subdom
<Directory /var/www/subdom/cgi-bin>
Options +ExecCGI
AllowOverride All
AddHandler cgi-script cgi pl
Order allow,deny
allow from all
</Directory>
</VirtualHost>
非常感谢任何和所有帮助。