本文主要是介绍trac apache2 config,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Trac是Edgewall公司推出的网页界面专案管理软件,尤其擅长软件BUG跟踪方面代码集成管理工具
1 trac安装
apt-get install trac
2 配置trac建立trac的工作目录
trac 用目录和数据库来储存项目信息,叫做“环境”,一个新的trac环境是通过
trac-admin创建出来的,trac环境可以放至任意位置,由于trac是个web应用,是
通过apache来访问的 initenv是工作环境
# trac-admin /wolf/trac initenv
Creating a new Trac environment at /wolf/trac
输入项目名称
Project Name [My Project]> linux2.6.35
数据库使用默认值 回车
Database connection string [sqlite:db/trac.db]>
默认用svn回车
Repository type [svn]>
输入代码仓库的路径/wolf/svn/linux_2.6.35_project
Path to repository [/path/to/repos]> /wolf/svn/linux_2.6.35_project
---------------------------------------------------------------------
Project environment for 'linux2.6.35' created.
You may now configure the environment by editing the file:
配置文件
/wolf/trac/conf/trac.ini
If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:
访问端口
tracd --port 8000 /wolf/trac
Then point your browser to http://localhost:8000/trac.
There you can also browse the documentation for your installed
version of Trac, including information on further setup (such as
deploying Trac to a real web server).
The latest documentation can also always be found on the project
website:
http://trac.edgewall.org/
配置成功
Congratulations!
2 设置访问trac的权限
# chown -R root:www-data /wolf/trac
设置组的访问权限
# chmod -R g+rws /wolf/trac
设置一个保存密码的文件passwd.digest 是存放密码文件 localhost是访问的域名 www-data是访问的用户
htdigest -c /wolf/trac/passwd.digest localhost www-data
输入密码123456
New password:
Re-type new password:
为trac添加一个用户管理员的权限
# trac-admin /wolf/trac permission add admin TICKET_ADMIN
3 配置trac.ini
# vi /wolf/trac/conf/trac.ini
换一下logo
[header_logo]
alt = (please configure the [header_logo] section in trac.ini)
height = -1
link =
src = site/your_project_logo.png
width = -1
换成
[header_logo]
alt =
height = -1
link =
src = common/trac_banner.png //可以替换成我们需要的工程log
width = -1
4 配置subversion的访问权限
# chown -R root:www-data /wolf/svn/linux_2.6.35_project
#chmod -R g+rws /wolf/svn/linux_2.6.35_project
5 启动一个trac的服务
# tracd --port 8000 /wolf/trac & 放在后台运行
[4] 6319
# Server starting in PID 2353.
Serving on 0.0.0.0:8000 view at http://127.0.0.1:8000/
回车
6 启动一个IE浏览器来测试
http://192.168.137.72:8000/
7 trac与apache2的集成CGI
1)配置apache站点文件
# vi /etc/apache2/sites-enabled/000-default
添加trac的配置
可以看一下trac的配置
Alias /trac/ "/wolf/trac/htdocs/"
SetEnv TRAC_ENV "/var/www/trac"
<Directory "/wolf/trac/htdocs/">
Options +ExecCGI Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Location "/cgi-bin/trac.cgi">
SetEnv TRAC_ENV "/wolf/trac"
SetEnv PYTHON_EGG_CACHE "/tmp"
</Location>
<Location "/cgi-bin/trac.cgi/login">
AuthType Basic
AuthName "trac"
AuthUserFile /etc/apache2/trac.passwd
Require valid-user
</Location>
2) 生成授权文件
# htpasswd -c /etc/apache2/trac.passwd trac
New password:
输入密码123456
3)重新启动apache2服务器
/etc/init.d/apache2 restart
4)打开浏览器访问
8 配置Apache mod-python
1)配置svn访问方式
vi /etc/apache2/mods-available/dav_svn.conf
<Location /svn/linux_2.6.35_project>
DAV svn
SVNPath /wolf/svn/linux_2.6.35_project
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
# To enable authorization via mod_authz_svn
AuthzSVNAccessFile /etc/apache2/dav_svn.authz
Require valid-use
</Location>
用户授权信息
# htpasswd -c /etc/apache2/dav_svn.passwd user_name
New password:
Re-type new password:
Adding password for user user_name
# apt-get install libapache2-mod-python libapache2-mod-python-doc
# a2enmod python
Module python already enabled
vi /etc/apache2/httpd.conf
配置httpd.conf文件,在其中添加
<Location /wolf/trac/>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /wolf/trac/
PythonOption TracUriRoot /trac/
AuthType Basic
AuthName "Trac"
AuthUserFile /etc/apache2/dav_svn.passwd
require valid-user
</Location>
重新启动apache2服务器
/etc/init.d/apache2 restart
这篇关于trac apache2 config的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!