【发布时间】:2014-06-12 18:58:03
【问题描述】:
让我的网络服务器显示 CGI 内容让我费了一番周折。它正在显示脚本......我已经检查了几十次,所有文件都在正确的位置,一切都具有正确的权限和一切。啊。我究竟做错了什么?我花了三个小时在阳光下搜索了每个论坛。我正在为一个内部部门建立一个托管的 git repo,我快死了。我什至对日志运行了一个 tail -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 端口?我应该把它放到一个虚拟主机配置中吗?
【问题讨论】:
-
/var/www/gitweb/gitweb.cgi是否存在并且是否可执行? -
这一行缺少一个加号:
Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch -
@VonC 是的,它在那里并且可执行。 @miller 哪个部分?
Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch在我的版本中有它...