Skip to content

Instantly share code, notes, and snippets.

@jgrip
Last active November 3, 2017 10:44
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jgrip/9a358a3c50c73dec513b to your computer and use it in GitHub Desktop.
Save jgrip/9a358a3c50c73dec513b to your computer and use it in GitHub Desktop.

default.conf

server {
    listen 443;
    server_name homelab.example.com;

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

    root /var/www/html;
    index index.html;

    include ssl.conf;

    location /couchpotato {
            proxy_pass http://internal.example.com:5050;
            include proxy.conf;
            proxy_redirect off;
    }
    location /sabnzbd {
            proxy_pass http://internal.example.com:8080;
            include proxy.conf;
    }
    location /sickrage {
            proxy_pass http://internal.example.com:8081;
            include proxy.conf;
    }
}

ssl.conf

ssl on;
ssl_certificate /etc/ssl/certs/homelab.example.com.crt;
ssl_certificate_key /etc/ssl/private/homelab.example.com.key;

proxy.conf

proxy_connect_timeout   59s;
proxy_send_timeout      600;
proxy_read_timeout      600;
proxy_buffer_size       64k;
proxy_buffers           16 32k;
proxy_pass_header       Set-Cookie;
proxy_hide_header       Vary;

proxy_busy_buffers_size         64k;
proxy_temp_file_write_size      64k;

proxy_set_header        Accept-Encoding         '';
proxy_ignore_headers    Cache-Control           Expires;
proxy_set_header        Referer                 $http_referer;
proxy_set_header        Host                    $host;
proxy_set_header        Cookie                  $http_cookie;
proxy_set_header        X-Real-IP               $remote_addr;
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-Forwarded-Port        '443';
proxy_set_header        X-Forwarded-Ssl         on;
proxy_set_header        X-Forwarded-Proto       https;
proxy_set_header        Authorization           '';

proxy_redirect         http://homelab.example.com/ /;
proxy_redirect         https://homelab.example.com/ /;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment