Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

Nginx Proxy

Stéfan Sinclair edited this page Mar 29, 2018 · 1 revision

Nginx is a relatively lightweight and fast web server that's widely used to proxy other web applications (such as VoyantServer). One advantage of a proxy is that the visitor can get a response even if the underlying instance of VoyantServer is temporarily unavailable.

Sample Site Configuration for Tomcat

upstream tomcat {
    server localhost:8080; # assuming you're running Tomcat on port 8080
}

# this accepts both http and https requests, you may want to be more selective
server {
   listen 80 default_server;
   listen [::]:80 default_server;
   listen 443 ssl default_server;
   listen [::]:443 ssl default_server;

   server_name voyant-tools.org; # YOU'LL PRESUMABLY CHANGE THIS TO YOUR SERVER NAME

   ssl_certificate # YOUR FILE HERE
   ssl_certificate_key # YOUR FILE HERE

    location / {
	client_max_body_size 0;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header  X-Real-IP  $remote_addr;
	proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://tomcat;
    }
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
                internal;
        }
}