I did this using the standard Teamcity Windows installer, and presumably it would work on any platform.
Change Teamcity Location
As per a comment by a JetBrains employee:
To change TeamCity address from http://server/
to http://server/teamcity/
, rename the <TeamCity home>\webapps\ROOT
directory to <TeamCity home>\webapps\teamcity
.
Note also that you'll need to rename this directory every time you upgrade Teamcity.
Proxy configuration
The nginx config then looks something like:
location /teamcity/ {
proxy_pass http://teamcity-server.domain.com/teamcity/;
}
Or you can use Apache (I switched to Apache due to authentication requirements I had):
<Location /teamcity>
ProxyPass http://teamcity-server.domain.com/teamcity
ProxyPassReverse http://teamcity-server.domain.com/teamcity
</Location>
Redirect old URL
I also created a new <Teamcity home>\webapps\ROOT
, and put a index.jsp
file into it, which redirects to the new URL so old links continue to work (eg, if someone goes to http://teamcity-server.domain.com it redirects to http://teamcity-server.domain.com/teamcity):
<!DOCTYPE html>
<html>
<head>
<title>TeamCity</title>
<meta http-equiv="refresh" content="0;url=/teamcity/overview.html"/>
</head>
<body>
<!-- no content -->
</body>
</html>
You could also do the redirect in nginx/apache, but doing on the Teamcity server means if someone goes to the old URL directly on the teamcity web server (instead of via your proxy) they'll still get correctly redirected (instead of a 404).