Greg's Blog

helping me remember what I figure out

Deploying Grails App to Jetty

| Comments

Short and sweet, step by step guide for creating a grails war and deploying it to your Jetty server (includes apache2 proxy steps)
  1. grails war (your app), in this case epic.war
  2. Copy to server [code]scp epic.war user@server:/location[/code]
  3. On Debian the location for jetty webapps is: /var/lib/jetty/webapps
  4. Copy from upload location to the above folder (I used sudo)
  5. Change permissions: [code]sudo chown jetty:adm epic-0-0.1.war[/code]
  6. 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]
  7. restart jetty : [code]sudo /etc/init.d/jetty restart[/code] (try stop/start as well)
  8. test with : [code]lynx http://localhost:8080/epic/[/code]
  9. Nice but I’d like http://localhost/epic/ so enable mod_proxy in apache if you haven’t already : [code]a2enmod proxy[/code]
  10. 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]
  11. 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]
  12. restart apache :  [code]sudo /etc/init.d/apache2 restart[/code]
  13. 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: