On Thursday 04 October 2007, [EMAIL PROTECTED] wrote:
> did anyone manage to get this to work ?
> I would like to use trac via fastcgi but behind nginx instead of
> apache. I woud prefer to connect via socket.
> Can anyone supply an example ?

Here's an example, taken from a Debian etch system, see the attached files. 
unix:/dev/shm/trac-fcgi.sock is used for the communication between trac and 

The trac fcgi process is started like this:

env PYTHONPATH=/path/to/site-packages \
  PYTHON_EGG_CACHE=/var/tmp/.python-eggs \
  start-stop-daemon --start --pidfile /var/run/trac.pid \
  --chuidwww-data:www-data --background --make-pidfile \
  --exec /usr/lib/cgi-bin/trac.fcgi

and can easily be stopped using 

start-stop-daemon --stop --pidfile /var/run/trac.pid

For debian, fastcgi_params is already provided by the nginx package, but 
included here for reference anyway.

Depending on how you installed trac, you probably don't need to set 
PYTHONPATH, and you can also comment out lines 5+6 in trac.fcgi.

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
server {
        listen 80;
        server_name host.domain.example;

        location /login {
                fastcgi_pass unix:/dev/shm/trac-fcgi.sock;
                auth_basic "realm";
                auth_basic_user_file /path/to/passwd;
                include /etc/nginx/fastcgi_params;
                fastcgi_param trac.env_path /path/to/project;
                fastcgi_param PATH_INFO $fastcgi_script_name;
                fastcgi_param SCRIPT_NAME "";
                fastcgi_param AUTH_USER $remote_user;
                fastcgi_param REMOTE_USER $remote_user;

        location / {
                fastcgi_pass unix:/dev/shm/trac-fcgi.sock;
                include /etc/nginx/fastcgi_params;
                fastcgi_param trac.env_path /path/to/project;
                fastcgi_param PATH_INFO $fastcgi_script_name;
                fastcgi_param SCRIPT_NAME "";

Attachment: trac.fcgi
Description: application/python

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to