Ubuntu – Running TeamCity and YouTrack on same server and same port

teamcitytomcatUbuntu

I want to run both on the same server(ubuntu linux) using the self contain jars (if that's what they are called) downloaded from jetbrains.com. I think they run some internal tomcat/catalina server using java.

I've been running these on different ports and used different hostnames to avoid session problems(since from what I understand sessions are bound to the hostname).

Both hostnames buildserver.local and youtrack.local points to the same ip address. But on different ports to define what server to respond to the request. This is causing a bit of trouble with out firefwall that only allows port 80 from outside the firewall.

Is there anyway to config these servers/services to respond based on hostname instead of port?

Also in the config file there's an attribute on the Connector node called "redirectPort" in server.xml. What does it do?

..fredrik

EDIT:

I made virtual host in apache to try to redirect to my internal addresses.

NameVirtualHost *:80

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass / http://youtrack.local:8080/
    ProxyPassReverse / http://youtrack.loca:8080/
    ServerName youtrack.local
    ServerAdmin youtrack@something.com
</VirtualHost>

But I get 403-error. And in the apache error log I get this:

client denied by server configuration: proxy:http://youtrack.local:8080/

It works when I'm on my local network at work or over VPN. So I think it's some where the apache config. Any ideas?

EDIT2:

Found the solution. In apache2/mods-enable/proxy.conf one need to change in the section to this:

<Proxy *>
            AddDefaultCharset off
            Order deny,allow
            Deny from all
            Allow from all
    </Proxy>

Warning: This will allow every request to be passed over the proxy. You might want to check in to mod_access to restrict access.

Best Answer

I don't know if there's something you can do within Tomcat to listen for HTTP host headers, but if you install Apache, have it listen on port 80, and depending on the HTTP host that's requested (virtualdir) have it do a Proxy connection back to the tomcat instance on their respective ports.