How do I map my domain URL to the root folder of my Grails application?

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

http://localhost:port/abc 

I deployed my application on Amazon EC2 with a flexible IP address that I can get directly, like

 http://1.2.3.4/abc 

I have a domain name xyz.com, and I indicated that on my elastic IP, so now I can go to

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

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

What is the best way to do this? Should I somehow change the configuration of the domain name or change the tomcat settings in some way or something else?

thanks

+4
source share
2 answers

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 a local application with a root context, add this line to application.properties

 app.context=/ 

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

+2
source

You can create Virtual Hosts in Tomcat . Do a pretty good job explaining this on the linked page, so I wonโ€™t rephrase it here.

+1
source

Source: https://habr.com/ru/post/1300613/


All Articles