我通过包管理器安装了 CGI 并启用了 mod,但两个小时后我仍然无法让它工作。
我的/etc/apache2/sites-available/default
是:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
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>
<IfModule mod_alias.c>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory /var/www/cgi-bin/>
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</IfModule>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
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
</VirtualHost>
CGI 已启用。当我浏览时,mydomain.com/cgi-bin/
它会转到/usr/lib/cgi
(我相信)。
root@zeus:~# a2enmod cgi
Module cgi already enabled
root@zeus:~# apt-get install php5-cgi
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-cgi is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@zeus:~# sudo service apache2 restart
[....] Restarting web server: apache2[Wed Apr 23 20:20:28 2014] [warn] The ScriptAlias directive in /etc/apache2/sites-enabled/000-default at line 29 will probably never match because it overlaps an earlier ScriptAlias.
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
... waiting [Wed Apr 23 20:20:29 2014] [warn] The ScriptAlias directive in /etc/apache2/sites-enabled/000-default at line 29 will probably never match because it overlaps an earlier ScriptAlias.
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
. ok