Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
I wanted to automate as much as possible the process of configuring the Apache Tomcat Redirector for IIS 7. You can find detailed how-to documents describing how to configure the ISAPI filter manually, but I couldn’t find any ready-made scripts to automate the process using IIS 7’s AppCmd command. My goal is eventually to get Apache and an IIS front-end running in Windows Azure, but this will have to wait for another post!
The first thing you need to do is of course to download the ISAPI filter binaries from the Apache repository. Be careful to download the 64bit version if you run a 64bit OS, like Windows Server 2008 R2, or you will see error messages when IIS tries to load the IIS filter.
The other thing I couldn’t find immediately are the sample configuration files that are mentioned in the Apache documentation (workers.properties and uriworkermap.properties); I finally found them in the source archive, so I would advise you to download this as well, and look in the conf directory for the samples.
Then you need to organize things somewhat on your drive; I arranged the various files like so:
C:.
+---conf
| uriworkermap.properties
| workers.properties
|
+---isapi
| isapi_redirect.dll
| isapi_redirect.properties
|
\---logs
A couple notes:
And now, the isapi_redirect.properties file:
# Configuration file for the Jakarta 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=/jakarta/isapi_redirect.dll
# Full path to the log file for the ISAPI Redirector
log_file=C:\jk\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:\jk\conf\workers.properties
# Full path to the uriworkermap.properties file
worker_mount_file=C:\jk\conf\uriworkermap.properties
And now we need to configure IIS so that it will run the ISAPI filter; there are basically four tasks we need to accomplish:
And without further ado, the script!
PATH %PATH%;%SystemRoot%\System32\inetsrv
for /f "tokens=*" %i in ('appcmd.exe list site /text:name') do set SITE=%i
appcmd.exe set config /section:isapiCgiRestriction /+[@start,description='Tomcat',path='C:\jk\isapi\isapi_redirect.dll',allowed='true']
appcmd.exe set config /section:isapiFilters /+[@start,name='Tomcat',path='C:\jk\isapi\isapi_redirect.dll']
appcmd.exe add vdir /app.name:"%SITE%/" /path:/jakarta /physicalPath:c:\jk\isapi
appcmd.exe set config "%SITE%/jakarta" /section:system.webServer/handlers /accessPolicy:Read,Write,Execute
iisreset.exe /restart
Here are a few details about what is going on:
I hope this helps, at least it Worked On My Machine! ™
Anonymous
September 05, 2012
Hi
I have just seen after uncessfully trying to disable IIS 7 on my SharePont 2010 dev VM. In my case I want XAMP install to host a local copy of myblog.local ... . will give this a try an report back
Daniel
Anonymous
August 26, 2013
Hey,
FYI you can use variables $(JKISAPI_PATH) and $(JKISAPI_NAME) in the isapi_redirect.properties file.. will help your automation even more. This way you can put the files anywhere and not have to configure the properties file! Enjoy. :)
For example;
server_root=$(JKISAPI_PATH)
extension_uri=/jakarta/$(JKISAPI_NAME).dll
worker_file=$(JKISAPI_PATH)workers.properties
log_file=$(JKISAPI_PATH)logs$(JKISAPI_NAME).log
worker_mount_file=$(JKISAPI_PATH)uriworkermap.properties
rewrite_rule_file=$(JKISAPI_PATH)rewrite.properties
log_level=warn
Please sign in to use this experience.
Sign in