Skip to content

Nginx as a reverse proxy

Jeremy Ryan edited this page Apr 9, 2018 · 10 revisions

On the root of a domain

  1. On the settings page, set the Base URL that you will use after configuring nginx. EG: http://example.com

  2. Configure nginx:

server {
  listen 80;

  server_name example.com;

  location / {
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass http://localhost:8080;
  }
}

On a subdirectory

  1. On the settings page, set the Base URL that you will use after configuring nginx. EG: http://example.com/streama

  2. Set application.yml

In the application.yml set:

environments:
    production:
        grails:
            assets:
                url: http://example.com/streama/assets/
  1. Configure nginx:
server {
  listen 80 ;

  server_name example.com;

  location /streama/ {
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      rewrite ^/streama/(.*)$ /$1 break;
      proxy_pass http://localhost:8080;
  }
}