Raspberry Pi Reverse Proxy

From ProjectPages
Jump to: navigation, search

Get nginx up and running with let's Encrypt using Update: Using Free Let’s Encrypt SSL/TLS Certificates with NGINX

Then edit your .conf file in /etc/nginx/conf.d

server {
    root /var/www/html;
    server_name farleigh-hass.net www.farleigh-hass.net;

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/farleigh-hass.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/farleigh-hass.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot



####### Add these lines to the config after adding certificates ######


    location / {
        proxy_pass http://192.168.68.130:8123;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

########################################################################

}
server {
    if ($host = www.farleigh-hass.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = farleigh-hass.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80 default_server;
    listen [::]:80 default_server;
    server_name farleigh-hass.net www.farleigh-hass.net;
    return 404; # managed by Certbot
}

Links