Working reverse proxy (for me)

Hi there,

I was looking for a solution for reverse proxy within my local network, after looking for a week, I got it running with these templates:

location templates: /usr/local/hestia/data/templates/web/nginx

tpl:

server {
            listen      %ip%:%proxy_port%;
            server_name %domain_idn% %alias_idn%;
            error_log   /var/log/%web_system%/domains/%domain%.error.log error;

            include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;

            location ~ /\.(?!well-known\/|file) {
                    deny all;
                    return 404;
            }

            location / {
                    proxy_pass http://192.168.1.2:51821;
            }

            location @fallback {
                    proxy_pass http://%ip%:%web_port%;
            }

            location /error/ {
                    alias %home%/%user%/web/%domain%/document_errors/;
            }

            include %home%/%user%/conf/web/%domain%/nginx.conf_*;
    }


stpl:



server {
            listen      %ip%:%proxy_ssl_port% ssl;
            server_name %domain_idn% %alias_idn%;
            error_log   /var/log/%web_system%/domains/%domain%.error.log error;

            ssl_certificate     %ssl_pem%;
            ssl_certificate_key %ssl_key%;


            # TLS 1.3 0-RTT anti-replay
            if ($anti_replay = 307) { return 307 https://$host$request_uri; }
            if ($anti_replay = 425) { return 425; }

            include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;

            location ~ /\.(?!well-known\/|file) {
                    deny all;
                    return 404;
            }

            location / {
                    proxy_pass http://192.168.1.2:51821;

Works likes a charm :slight_smile:

1 Like

afaik you should delete these two stapling lines…

Will do that :slight_smile:

I got a question, do you know hw I can setup a reverse proxy to another ip adress that uses 80 & 443 and already has letsencrypt installed on the other server.