Edgewall Software

Version 1 (modified by Wilfred Berger <wilfred.berger@…>, 15 years ago) ( diff )

Running Trac on IIS 6 using AJP

Running Trac on IIS 6 using AJP

For:

  • Windows Server 2003 SP2
  • IIS 6
  • Trac 0.11

Contributed by:
Wilfred Berger, Statistisches Landesamt, Stuttgart, Germany

Why this?

If you want to run Trac on a Windows system, your first choice will be running tracd stand-alone.
This may be impossible for several reasons:

  • tracd does not support HTTPS. If you want to serve HTTPS, you will have to connect Trac to a common web server.
  • If you want to mix Trac with other content in your web site, you will again have to connect Trac to another web server.

In both cases, the web server on a Windows system will most probably be IIS.

Generally, it is not a good idea to use CGI on a Windows system. CGI implies starting a new system process for every single request, which, on Windows, causes significant overhead and makes things slow.

The following solution uses AJP. This protocol was developped for connecting Tomcat to a web server which is very similar to what we are doing here.

1. Install Trac

… exactly as if you were going to run tracd stand-alone, with two exceptions:

  • Since port 80 will be occupied by IIS, choose a different port, including "-p 8009" to the tracd start command.

Of course, 8009 is an example and you are free to use any other port as well.
At this point you should check whether Trac is running properly.

  • Use "--protocol=ajp" to make tracd use AJP instead of HTTP.

Now you will get an error message indicating that module flup.server.ajp is missing. (If you don't, flup is already installed and you may skip th following step.)

2. Install flup

  • Copy flup-1.0-py2.5.egg to C:\Python25\Scripts (or whatever may be your Python installation directory).
  • Run easy_install flup.

Now tracd should start without an error.

3. Install Tomcat AJP Connector for IIS

  • Set up the directory structure.

We assume there will be a base directory named C:\AJP-Connector and three subdirectories bin, conf and logs. Of course, you may chooe anything else for the base directory.

  • Copy isapi_redirect-1.2.26.dll to the bin subdirectory.
  • Create a configuration file isapi_redirect-1.2.26.properties for the ISAPI redirector.

This must be in the same directory as the DLL and have exactly the same name but with a .properties extension. The configuration file should contain this: (be sure to replace "C:\AJP-Connector" with your actual directory)

# Configuration file for the ISAPI Redirector

# The path to the ISAPI Redirector Extension, relative to the website
# This must be in a virtual directory with execute privileges
extension_uri=/AJP-Connector/isapi_redirect-1.2.26.dll

# Full path to the log file for the ISAPI Redirector
log_file=C:\AJP-Connector\logs\isapi_redirect.log

# Log level (debug, info, warn, error or trace)
log_level=info

# Full path to the workers.properties file
worker_file=C:\AJP-Connector\conf\workers.properties

# Full path to the uriworkermap.properties file
worker_mount_file=C:\AJP-Connector\conf\uriworkermap.properties
  • Create the workers.properties file with the following content: (replace the host name and port if necessary)
# Define 1 real worker
worker.list=trac
# Set properties for trac (ajp13)
worker.trac.type=ajp13
worker.trac.host=localhost
worker.trac.port=8009
worker.trac.socket_keepalive=0
  • Create the uriworkermap.properties file with the following content: (insert the proper trac directory names)
/your-first-trac-directory*=trac
/your-second-trac-directory*=trac
  • Define the virtual directory for IIS
    • Start the IIS Manager. (This is normally found at %SystemRoot%\system32\inetsrv\iis.msc).
    • Define a virtual directory named "AJP-Connector", pointing to your bin subdirectory, with permissions to execute executables (not only scripts).
  • Allow execution of the DLL as Web Service Extension
    • In the IIS Manager, open Web Service Extensions.
    • Define a new Web Service Extension called AJP-Connector (or whatever you want).
    • Add C:\AJP-Connector\bin\isapi_redirect-1.2.26.dll to the required files (replace "C:\AJP-Connector" with your actual directory).
    • Set extension status to Allowed.
    • Click OK.

4. Enjoy

That's everything I did and it works.

Note: See TracWiki for help on using the wiki.