How to run IIS and Apache Tomcat together on port 80

Classic problem: you’re running Windows and you need to run Apache TomCat without resorting to using port 8080, or somesuch.

For me, I needed to install Atlassian JIRA on a Windows machine that was running some other sites on IIS.  I found this terrific blog post which set the foundation for this post. Take a look at it first.

The answer is relatively simple, but you need another IP address to do this. IIS, by default, binds to all IP addresses available on the machine. You can set the machine to only bind to a specific IP address using Netsh, which comes with Windows 2008 and up (for Window2003 you need httpcfg which is bundled with the Support Tools ). Note that all ports per IP are bound. You cannot pick and choose ports.

  1. Use Netsh. Google for commands – sorry, don’t have time for the details.Tip: by default the bind list is empty. When you add the IP it will force IIS to use ONLY what you are binding.
  2. Go to IIS and set all your sites to a specific IP/s from * (just to remove any doubt) as it will still list all IPs bound to the card.
  3. Restart the machine or all the HTTP services (I prefer reboots to make sure)
  4. Do netstat -an and you should see only your bound IP – it might be a long list of output.
  5. Find the server.xml in JIRAconf. Make a backup.
  6. Big difference to the blog post: I had to tell Tomcat to bind to a specific IP address to get it to work. Simply add address=”XX.XX.XX.XX”, as below. Replace the X’s with your IP, of course (and make sure it is not the IP you bound using netsh – I was a little sleepy and added the wrong IP initially).
  7. <Connector port=”80
    maxThreads=”150″
    minSpareThreads=”25″
    connectionTimeout=”20000″
    enableLookups=”false”
    maxHttpHeaderSize=”8192″
    protocol=”HTTP/1.1″
    useBodyEncodingForURI=”true”
    redirectPort=”8443″
    address=”XX.XX.XX.XX”
    acceptCount=”100″
    disableUploadTimeout=”true”/>
  8. Restart JIRA and voila.

I HIGHLY recommend restarting the entire machine to make sure everything still works.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.