server {
   listen 80;
   server_name shorturl.my.domain;
   root /opt/local/www/;

   # proxy glassfish
   location / {
      # Proxy all requests to Glassfish
      proxy_pass http://127.0.0.1:8080/shorturl/;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;

      proxy_cache one;
      proxy_cache_min_uses 1;
      proxy_cache_valid  200 302 1m;
      proxy_cache_valid  404 1m;
      proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504;
   }

   # serve static resources directly
   location ~ ^/resources/(components|css|images|javascript?)/(.*)$ {
      alias /opt/local/www/shorturl/$1/$2;
   }

   location ~ ^/favicon.ico$ {
      alias /opt/local/www/shorturl/favicon.ico;
   }
}