Wednesday, October 31, 2012

Putting TeamCity behind mod_proxy

As part of a new project I wanted to evaluate Jenkins and TeamCity on the same server. I decided that changing the root directory and placing them behind Apache using mod_proxy would be the way to go. The goal was to have two urls; http://myserver/tc and http://myserver/jenkins.

Setting up Jenkins was a simple affair but TeamCity was less straightforward. My search of putting TeamCity behind mod_proxy threw up this post: http://devnet.jetbrains.net/thread/275501. The solution posted at the end of the thread is the way to go but it didn't work on my Windows setup.

When you do the initial install, your directory structure will look similar to this:


Default TeamCity Directory Structure on Windows
Following the instructions in the post, step 1 moves the ROOT to tc (or whatever name you selected). This would give you .\webapps\tc\ROOT\. In fact you should rename ROOT to tc and end up with the structure below.


Modified TeamCity Directory Structure
My mistake was to take the move literally. I created the tc directory then called MOVE. The commands mv and MOVE will rename the current object if the destination doesn't exist.

Hopefully this will save you some time.