# Sample Config file for testing fast cgi scripts. # # There are two common styles for "CGI" scripts. One uses # a file suffix to deterimine which executable file to run, # the other uses a url prefix and a fixed "executable file" # and "runs" everything with that prefix # # This example demonstrates both techniques by supporting # "wordpress" (written in PHP) which uses the first technique # and "trac" (whitten in python) which uses the second one. # # The paths, hostnames, and ports will need to be changed for # you environment, and the fast-cgi applications need to be started # outside the scope of Brazil. # # See notes at end of file for setting up wordpress and trac log=3 port=8999 root=. handler=main main.class=sunlabs.brazil.server.ChainHandler # Processing steps # - trac-auth: obtain credentials for trac # - default: find "index.php" files for directory references, # for "wordpress # - wordpress: Send all "php" url's to the PHP fast-cgi socket # - file Process static files locally. This needs to go # be for "trac" to avoid requesting static content via # the fcgi socket. It can go after "wordpress" as that # explicitly looks for ".php" files. # - trac: Send these requests to the python process main.handlers = trac-auth default wordpress file trac # trac depends on the web server to provide authentication. # For this example, we'll use digest authentication for # any of the "trac" URL's # the file "users.data" can contain user credentials in the form: # user1=password1 # user2=password2 trac-auth.prefix=/trac/login trac-auth.class=sunlabs.brazil.handler.DigestAuthHandler trac-auth.realm=trac trac-auth.credentials=users.data # For directories ending in "/", look for php files first default.class=sunlabs.brazil.handler.DefaultFileHandler default.defaults=index.php index.html # Send all php requests to the php socket. Since php might # be running on a different machine, set the "root" property # to refer the document root of the php scripts on the php-serving # machine, which is likely different from the document root for # this server wordpress.class=sunlabs.brazil.sunlabs.FastCgiHandler wordpress.suffix=.php wordpress.host=localhost:9001 wordpress.root=/export/home/suhler/htdocs # deliver static content, setting up the (non built-in) # mime-types as needed file.class=sunlabs.brazil.server.FileHandler mime.css=text/css # send all URLs under /trac to the python server. Make sure # to pass the authenticated user (From the DigestAuthHandler) to trac.class=sunlabs.brazil.sunlabs.FastCgiHandler trac.prefix=/trac trac.host=localhost:9009 trac.root=/export/home/suhler/htdocs trac.env=trac.auth trac.auth.name=REMOTE_USER trac.auth.value=${auth.username} # installation notes # @ wordpress # - Start php in fast-cgi mode with: # php-cgi -b 9001 # - if you are going to run PHP from a different host, place a copy # of the wordpress directory on the server machine (in the document # root) and on the PHP machine, in the location indicated by # the "wordpress.root" parameter. All the non-PHP content will be # processed on the local machine, using the "fileHandler", and all # the php content will be processed from the remote machine. # @ trac # - Install the trac files as per the instructions (e.g. using # "easy_install") # - python is best started in FCGI mode using spawn-fcgi, with the # following script: # # this is the location where trac was installed # export PYTHONPATH=/export/home/suhler/trac # # this is the directory created by: # # trac-admin $TRAC_ENV initenv # export TRAC_ENV=/export/home/suhler/trac-project # # This starts the python fastcgi server # ./spawn-fcgi -p 9009 /bin/python \ # $PYTNONPATH/Trac-0.11-py2.4.egg/trac/web/fcgi_frontend.py # - Since the scripts and the static content can be running on # different machines, trac provides a "trac-admin deploy" option # do deploy the static content on the web server machine, so it # the static content can be servered directly by the web server. # # References # # - wordpress: http://wordpress.org/ # - trac: http://trac.edgewall.org/ # - php: http://www.php.net/ # - python: http://www.python.org/ # - fast-cgi spec: http://www.fastcgi.com # - spawn-fcgi: http://redmine.lighttpd.net/projects/spawn-fcgi