I have Groovy on Grails app deployed on Tomcat/Apache (CentOS). Currently, it is accessed via a URL like http://www.domain.com:8080/AppName. I would like to access it via http://www.domain.com.
How do I go about this?
|
I have Groovy on Grails app deployed on Tomcat/Apache (CentOS). Currently, it is accessed via a URL like http://www.domain.com:8080/AppName. I would like to access it via http://www.domain.com. How do I go about this? |
|||
|
|
|
I assume that you are trying to move Apache can be configured to do this. You will just need to set up *mod_proxy* with the following config:
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. |
|||
|
|
Setup your server to listen on port 80. |
|||
|
|
|
I tried too solutions for that:
|
|||
|
|
|
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. |
|||
|
|
|
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:
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. |
|||
|
|
|
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: app1.domain.com app2.domain.com Forwarding to the same server internally on different ports. |
|||
|
|