我有一段时间让我的网络服务器显示CGI内容。它正在显示脚本...我已经检查了几十次,所有文件都在正确的位置,一切都有正确的权限和一切。啊。我究竟做错了什么?我花了三个小时在阳光下搜索每个论坛。我正在为一个内部部门设置一个托管的git仓库,而我正在死去。我甚至对日志运行了一个尾巴-f,我无法弄明白。我一直在关注本教程:http://git-scm.com/book/en/Git-on-the-Server。作为参考,我一遍又一遍地阅读:http://httpd.apache.org/docs/1.3/howto/cgi.html#configuringapachetopermitcgi。在我做到这一点之前,我对一切都很擅长:
<VirtualHost *:80>
ServerName gitserver
DocumentRoot /var/www/gitweb
<Directory /var/www/gitweb>
Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
order allow,deny
Allow from all
AddHandler cgi-script cgi
DirectoryIndex gitweb.cgi
</Directory>
</VirtualHost>
这是我的Perl:
localdev1@brm-jedi:/etc/apache2/sites-enabled$ which perl
/usr/bin/perl
它必须在这里。我错误地配置了某些东西,但现在是凌晨1:30,我从下午4:30开始就一直在这里,我无法弄明白。这就是我所拥有的:
#<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin something@somewhere
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
#</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
<VirtualHost *:80>
ServerName git.brmstorage.com
DocumentRoot /brmstorage.git
<Directory /brmstorage.git/>
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName brm-jedi.brmstorage.com
DocumentRoot /var/www/gitweb/
ScriptAlias /brmstorage.git/ /usr/lib/cgi-bin/
<Directory /var/www/gitweb>
Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
order allow,deny
Allow from all
AddHandler cgi-script cgi
DirectoryIndex gitweb.cgi
</Directory>
</VirtualHost>
作为旁注,这是这个Web服务器唯一的用途,repo和gitweb功能。
请尽可能详细了解我出错的地方。
我是否有两个指向端口80的虚拟主机?我应该把它变成一个虚拟主机配置吗?
答案 0 :(得分:2)
问题很可能是apache上没有启用cgid。
运行
a2enmod cgid
service apache2 force-reload
为我做了诀窍。