我无法让 viewvc 在 Ubuntu 16.04 中运行。(相同的设置在 Ubuntu 15.10 中可以运行。)/var/log/apache2/error.log 中的错误消息是:
[authz_core:error] [pid 24296]
[client 192.168.1.34:37586] AH01630: client denied by server configuration:
/usr/lib/cgi-bin/viewvc.cgi
这是我所做的。我安装了软件包:
sudo apt install viewvc
配置/etc/viewvc/viewvc.conf
:
[general]
root_parents = /data/svnrepo : svn
[options]
root_as_url_component = 1
allowed_views = annotate, diff, markup, roots, co
template_dir = /etc/viewvc/templates
设置 Apache 虚拟主机:
<VirtualHost *:80>
ServerAdmin smith@localhost
ServerName svn.example.com
Alias /docroot /usr/share/viewvc/docroot
ScriptAlias / /usr/lib/cgi-bin/viewvc.cgi/
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
<Directory /usr/lib/cgi-bin/viewvc.cgi/>
Require all granted
</Directory>
<Directory /usr/share/viewvc/docroot>
Require all granted
</Directory>
</VirtualHost>
启用它并重新启动 apache(没有错误):
sudo a2ensite svn.example.com.conf
sudo service apache2 restart
但每当我访问 svn.example.com 时,都会出现此错误:
Sun Sep 25 14:25:24.430254 2016] [authz_core:error] [pid 24296]
[client 192.168.1.34:37586] AH01630: client denied by server configuration:
/usr/lib/cgi-bin/viewvc.cgi, referer: http://svn.example.com/
我已经尝试过(但没有解决问题):
- 安装 libapache2-svn
- 删除所有
AllowOverride
和Require
指令/etc/apache2/apache2.conf
- 使用 Apache 2.2 语法 (
Order allow, deny
,Allow from all
) - 添加
Options FollowSymLinks
和ExecCGI
AddHandler cgi-script cgi
iptables -F
- 关于的建议这一页
欢迎提出任何建议!
答案1
问题是CGI 模块未启用,所以ScriptAlias
命令不起作用。解决方案是:
$ sudo a2enmod cgi
$ sudo service apache2 restart
并刷新浏览器。
我还可以通过删除以下<Directory>
部分来简化 Apache 配置:
<VirtualHost *:80>
ServerAdmin smith@localhost
ServerName svn.example.com
Alias /docroot /usr/share/viewvc/docroot
ScriptAlias / /usr/lib/cgi-bin/viewvc.cgi/
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
谢谢C.迈克尔·皮拉托帮助我指明正确的方向。