alexbates / Tamari

A fully-featured recipe manager web application built using Python and the Flask Framework.
https://tamariapp.com
GNU General Public License v3.0
73 stars 1 forks source link

Config for Nginx Proxy Manager #5

Open IlanKD opened 1 month ago

IlanKD commented 1 month ago

Hi !

I don't know if it's a me issue but I'm using Nginx Proxy Manager and the code cited in the documentation didn't work. I add to delete some stuff, giving me this : ` location / {

proxy_pass http://your_public_ipv4:4888;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
proxy_redirect http://$http_host/ https://$http_host/;

} `

alexbates commented 1 month ago

What happens when you are using that code, do you get 502 Bad Gateway error? Assuming you are using an SSL certificate, does it make a difference if you disable SSL (for testing) with the following config? I added the "client_max_body_size" line to Documentation today due to Nginx occasionally throwing 413 error.

server { listen 80; server_name tamari.example.com; client_max_body_size 400M;

location {
    proxy_pass      http://127.0.0.1:4888;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
}

}

Would be happy to further help you diagnose!

IlanKD commented 1 month ago

Hi ! Yep 502 each time, with SSL, without, forcing https or not, setting the scheme http or https. Let me know what I can do to help you figure out the issue !

alexbates commented 1 month ago

I am assuming that Nginx is running on a separate system since you are using proxy_pass http://your_public_ipv4:4888;. From the system running Nginx, is Tamari accessible with curl (like below)?

$ curl http://your_public_ipv4:4888
<!doctype html>
<html lang=en>
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to the target URL: <a href="/login?next=%2F">/login?next=%2F</a>. If not, click the link.

Also, is Nginx running within a Docker container? If Nginx and Tamari were both deployed with Portainer on the same system, you would likely need to use proxy_pass http://tamari-container-name:4888;

IlanKD commented 1 month ago

Sorry, I got confused, I'm not using my public ipv4 but my private one, 192.168.1.xx. And yep Nginx is a docker container too, I never knew you could do that ! looking in this solution, thanks.