YunoHost behind a reverse proxy


#1

I’ve looked around and for now I only seem to find configurations for YunoHost as the reverse proxy, but I am using it only for testing and already have my own Nginx RP server up and running.

I use a no-ip domain for my testing and that is the domain I added to YunoHost. I started adding apps (mail server for example) and don’t know how that would translate with the RP…

Nginx conf

server {
    listen       80 default_server;
    server_name carobell.ddns.net;
    include snippets/letsencrypt.conf;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name carobell.ddns.net;

    ssl_certificate /etc/letsencrypt/live/carobell.ddns.net/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/carobell.ddns.net/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/carobell.ddns.net/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }

        location / {
                proxy_pass              http://192.168.2.56/;
#               proxy_set_header      X-Forwarded-For $remote_addr;
#               proxy_set_header      X-Real-IP $remote_addr;
#               proxy_set_header        X-Forwarded-Proto       $scheme;
#               proxy_set_header Host $host;
       }
}

If I leave the configuration as is, I get redirected to the LAN ip address of the YunoHost server. If I comment in the proxy_set_header I end up in a redirection loop.


J’ai regarder un peu partout et pour l’instant je trouve seulement des configurations pour utiliser YunoHost comme reverse proxy (proxy inversé?), mais dans mon cas je l’utilise seulement pour des test et j’ai déjà un Nginx RP en ligne et fonctionnel.

J’utilise un domaine no-ip pour mes test et c’est aussi le domaine que j’ai donné à YunoHost. J’ai commencer à ajouter des app (serveur mail par example) et je ne sais pas comment cela va se traduire avec le RP…

conf Nginx

voir version anglaise ;)

Si je laisse la configuration tel quel, je suis rediriger vers l’adresse ip LAN du serveur YunoHost. Si j’enleve les # je me retrouve dans une loop de redirection.


#2

Uuuuuh … but how does that relates to YunoHost ? YunoHost provides an automatically-managed nginx configuration and you copy-pasted a custom nginx configuration ? I’m not even sure to understand the issue you are trying to fix here ? o.O


#3

I have my own nginx server, I want to add YunoHost behind it (the 192.168.2.56 address it the LAN ip of YunoHost). if I leave YunoHost as is it won’t work since port 80 and 443 are already sent from my router to the Nginx Server,


#4

Hmokay

On one of my servers I used something like this :

location / {
        proxy_pass         https://192.168.x.y;
        proxy_redirect     off;
        proxy_read_timeout 60s;
        
        proxy_set_header          Host            the.desination.domain.tld;
        proxy_set_header          X-Real-IP       $remote_addr;
        proxy_set_header          X-Forwarded-For $proxy_add_x_forwarded_for;

        client_max_body_size 50M;
}

#5

It works!

Took a while I was missing the https in proxy_pass and the domain name in proxy_set_header Host took care of the lan redirection~