views:

236

answers:

2

I have a Grails app called abc, which when I access locally I get at through

http://localhost:port/abc

I have deployed my app up on Amazon EC2 with an elastic IP address which I can get at directly as

http://1.2.3.4/abc

I have a domain name of xyz.com and I have pointed that at my elastic IP, so now I can go to

http://xyz.com
http://www.xyz.com

The problem is that xyz.com points at the root folder for the tomcat server. What I want it to do is map the .com domains to http://1.2.3.4/abc so that my home page shows instead of the tomcat welcome screen.

What's the best way to do this? Should I reconfigure the domain name mapping somehow or should I change the tomcat settings somehow or something else?

Thanks

+1  A: 

If you rename the war file to ROOT.war (case sensitive) then when you deploy it to Tomcat it will be the root context at http://1.2.3.4/ and http://www.xyz.com will work.

If you also want to run your local app with the root context add this line to application.properties

app.context=/

and then 'grails run-app' will run at http://localhost:8080/

Burt Beckwith
Thanks. Does adding the property not work for all deployments? I am inferring from what you have written that it only works for localhost. I am deploying through CloudFoundry and I'm not sure that I can change the name of the war file it deploys, I'll investigate.
Simon
The property is only for run-app.
Burt Beckwith
A: 

You can create Virtual Hosts in Tomcat. The do a pretty good job of explaining it on the linked page so I won't try to paraphrase here.

Matt Lachman