Short and sweet, step by step guide for creating a grails war and deploying it to your Jetty server (includes apache2 proxy steps)
- grails war (your app), in this case epic.war
- Copy to server [code]scp epic.war user@server:/location[/code]
- On Debian the location for jetty webapps is: /var/lib/jetty/webapps
- Copy from upload location to the above folder (I used sudo)
- Change permissions: [code]sudo chown jetty:adm epic-0-0.1.war[/code]
- created a *.xml context file in /etc/jetty/contexts, with something like this [note case is important!!]:
[code]
/epic
/webapps/epic-0-0.1.war
[/code]
- restart jetty : [code]sudo /etc/init.d/jetty restart[/code] (try stop/start as well)
- test with : [code]lynx http://localhost:8080/epic/[/code]
- Nice but I’d like http://localhost/epic/ so enable mod_proxy in apache if you haven’t already : [code]a2enmod proxy[/code]
- edit /etc/apache2/mods-enabled/proxy.load and if not present add at end: [code]LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so[/code]
- edit your virtualhost conf file I am using 000-default and add:[code]ProxyRequests Off
Order deny,allow
Allow from all
ProxyPass /epic http://localhost:8080/epic
ProxyPassReverse /epic http://localhost:8080/epic
ProxyPreserveHost On[/code]
- restart apache : [code]sudo /etc/init.d/apache2 restart[/code]
- now you can [code]lynx http://localhost/epic/[/code]
Update: I had omitted the
ProxyPreserveHost On
from the Apache configuration, which resulted in css, images and external javascripts not loading. It also caused an issue with accessing controllers.
Sources: