Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Groovy on Grails app deployed on Tomcat/Apache (CentOS). Currently, it is accessed via a URL like I would like to access it via

How do I go about this?

share|improve this question
up vote 4 down vote accepted

I assume that you are trying to move to without the trailing AppName. In that case, you may want to consider running a reverse proxy in front of Tomcat. Merely switching the port from port 8080 to 80 would still require you to access your app via

Apache can be configured to do this. You will just need to set up *mod_proxy* with the following config:

ProxyPass / http://localhost:8080/AppName/
ProxyPassReverse / http://localhost:8080/AppName/

You can also do this with other web-servers such as lighttpd or nginx and what nots, basically most reverse proxies can do it in one form or another.

share|improve this answer
Removing the trailing AppName without a proxy is as simple as naming the application ROOT. If Tomcat runs multiple applications each with their own domain, a Host can be configured for each of them (like an Apache VirtualHost) – Bart van Heukelom Jul 7 '11 at 11:07
how to setup mod proxy? is this is available for apache2? – PeakGen Jul 24 '15 at 8:28

Setup your server to listen on port 80.

share|improve this answer

The specification is that if there is no port number on a URI, then the default is port 80.

I had a Tomcat application that was running as port 80, and I was concerned as the Tomcat would run as root (due to port 80). Furthermore, I could not really be sure of the security of the application. So I decided to make the changes necessary to run this as another un-privd port. My problem as yours is keep the URI simple. I found on the web a few steps that I needed to do, and I was on a Linux sytem.

First, redirect port 80 to port 8080 (my designated alternative). You can easily do this by activating iptables, and using the following simple directives:

iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A OUTPUT -d your_hostname -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -d your_hostname -p tcp --dport 80 -j REDIRECT --to-ports 8080

I believe that I substituted my IP number for both localhost and your_hostname when I configured this.

Then, you need to make some changes in the Tomcat configuration file: (1) change the connector port to 8080 (for this example) and the proxy port to 80. You can then run tomcat as a non-root user, still have the simple URI, and everybody is happy. Sorry that I cannot remember the specific XML file to change here.

share|improve this answer

I tried too solutions for that:

  • First one, i rund 2 tomcats servers behind a nginx web server as revers proxy, but i had problem with shared session, and i'm working on this solution.

  • Second one, that i kept is a kernel space port forwarding.

share|improve this answer

The default http port is 80, and unless you specify a port other than 80 in the URL your browser will attempt to connect to port 80. This is just the way that http works.

The solution is to reconfigure your web server to run on port 80 instead of port 8080. You'll need to check that there isn't already a site on port 80 first of course, and if there is your options are going to be limited.

share|improve this answer

If your clients are accessing the site from outside of your subnet and going through a router/firewall type device you can configure that to forward the external port 80 to internal port 8080.

That way you can provide what looks like a normal app to external clients, and internally you can see reality.

This is also useful for something like:

Forwarding to the same server internally on different ports.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.