Python: Trac SCM with FastCGI + LiteSpeed

We will detail how to setup a single Trac project using LiteSpeed and the FastCGI interface.

Live Demo: https://www.litespeedtech.com/products/webserver/demo/

  1. LiteSpeed
  2. Python

1) Please make sure you have first have a working install of a Trac project. Test install with “tracd” first.

2) Create a Virtual Host for this setup. From now on we will refer to this vhost as TracVhost. For this tutorial we will be assuming that your trac project will be accessible via:

http://yourdomain.com/trac/

3) Go “TracVhost → External Apps” tab and create a new “External Application”.

Name: MyTracFCGI	
Address: uds://tmp/lshttpd/mytracfcgi.sock
Max Connections: 10
Environment: TRAC_ENV=/fullpathto/mytracproject/ <--- path to root folder of trac project
Initial Request Timeout (secs): 30
Retry Timeout (secs): 0
Persistent Connection	Yes
Connection Keepalive Timeout: 30
Response Bufferring: No	
Start By Server: Yes
Command: /usr/share/trac/cgi-bin/trac.fcgi  <--- path to trac.fcgi
Back Log: 50
Instances: 10

4) Optional. If you need to use htpasswd based authentication. Go to “TracVhost → Security” tab and create a new security “Realm”.

DB Type: Password File
Realm Name: MyTracUserDB               <--- any name you wish and referenced later
User DB Location: /fullpathto/htpasswd <--- path to your htpasswd file

If you don't have a htpasswd file or don't know how to create the entries within one, go to http://sherylcanter.com/encrypt.php, to generate the user:password combos.

5) Go to “PythonVhost → Contexts” and create a new “FCGI Context”.

URI: /trac/                              <--- URI path to bind to python fcgi app we created	
Fast CGI App: [VHost Level] MyTractFCGI  <--- select the trac fcgi extapp we just created
Realm: TracUserDB                        <--- only if (4) is set. select ream created in (4)

6) Modify /fullpathto/mytracproject/conf/trac.ini

#find/set base_rul, url, and link variables
base_url = http://yourdomain.com/trac/ <--- base url to generate correct links to
url = http://yourdomain.com/trac/      <--- link of project
link = http://yourdomain.com/trac/     <--- link of graphic logo

7) Restart LiteSpeed, “lswsctrl restart”, and access your new Trac project at http://yourdomain.com/trac/. Enjoy! =)

  • Admin
  • Last modified: 2018/09/13 20:46
  • by Michael Alegre