nginx - amark/gun GitHub Wiki

server {
  listen 80;
  include /etc/nginx/conf/le-passthru.conf;
  server_name example.domain.com;
  return 301 https://example.domain.com$request_uri$args; # redirect to https
}
server {
   listen 443 ssl http2;
   include /etc/nginx/conf/le-example.domain.com.conf; # certificate configuration file
   include /etc/nginx/conf/le-passthru.conf; # certificate renewal passthru configs ( location path for letsencrypt acme validation with http-root)
   server_name example.domain.com;
   root /<path/to/user>/gun/examples/;
        location /gun {
          rewrite /gun/(.*) /$1 break;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $host;
          proxy_set_header X-NginX-Proxy true;
          proxy_pass_header Set-Cookie;
          proxy_pass_header P3P;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";
          proxy_redirect off;
          proxy_pass http://localhost:8765; # final proxy pass to your localhost gun instance
        }

}

Please contribute to this.