Skip to content

Reverse proxy configuration

Pierre-Alain TORET edited this page Mar 9, 2020 · 2 revisions

This is an example of a working configuration if you want to use dispatch behind Nginx with SSL and on a domain called dispatch.example.com

It assumes that dispatch is either started with dispatch -a 127.0.0.1 -p 9999 or that the config file contains the following lines

address = "127.0.0.1"
port = 9999

(If you're running dispatch in a container then 127.0.0.1 won't work, use address = "" or -a 0.0.0.0 as the address instead so that it will bind to any network interface.)

Here is the nginx configuration, assuming your SSL certificates are issued by LetsEncrypt and are located in /etc/letsencrypt/live/dispatch.example.com. Don't forget to replace your_ip on listen lines.

server {
    listen         your_ip:80;
    server_name    dispatch.example.com;
    return         301 https://$server_name$request_uri;

    access_log     /var/log/nginx/dispatch.example.com.access.log;
    error_log      /var/log/nginx/dispatch.example.com.error.log;

}

server {
    listen       your_ip:443 ssl http2;
    server_name  dispatch.example.com;

    ssl_certificate "/etc/letsencrypt/live/dispatch.example.com/fullchain.pem";
    ssl_certificate_key "/etc/letsencrypt/live/dispatch.example.com/privkey.pem";

    ssl_session_cache shared:SSL:50m;
    ssl_session_timeout  1d;
    ssl_session_tickets off;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ecdh_curve secp384r1;
    ssl_ciphers EECDH+AESGCM:EECDH+CHACHA20:EECDH+AES;
    ssl_prefer_server_ciphers on;
    add_header Strict-Transport-Security "max-age=15552000; preload";
    #ssl_dhparam /usr/local/etc/nginx/dhparam4096.pem;
    ssl_stapling on;
    ssl_stapling_verify on;

    access_log  /var/log/nginx/dispatch.example.com.access.log;
    error_log   /var/log/nginx/dispatch.example.com.error.log;

    location / {
            proxy_pass http://127.0.0.1:9999/;
            proxy_http_version 1.1;
            proxy_set_header Connection "upgrade";
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;
    }
}
Clone this wiki locally