Setting up nginx with https/ssl


#1

Hi guys,
I am having some issues with my nginx setup.
I run with https and a letscrypt certificate.
The setup actually works, mostly, but if I want to download a logfile, it dumps me at a 404.
I assume it's the path, that some how messes up, when I hit /downloads/logs/octoprint.log (example).

I have the following nginx setup:

        #octoprint
        map $http_upgrade $connection_upgrade {
            default upgrade;
            '' close;
        }

        upstream "octoprint" {
            server 192.168.1.143:80;
        }

        upstream "octoprintcam" {
            server 192.168.1.143:8080;
        }

# Octoprint                                                             
  location /octoprint/ {                                                
    proxy_pass http://octoprint;                                        
    proxy_set_header Host $host:$server_port;                           
    proxy_set_header Upgrade $http_upgrade;                             
    proxy_set_header Connection "upgrade";                              
    proxy_set_header X-Real-IP $remote_addr;                            
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        
    proxy_set_header X-Scheme $scheme;                                  
    proxy_set_header X-Script-Name /octoprint;                          
    proxy_http_version 1.1;                                             
  }                                                                     
  location ~ /octoprint/(?<pathinfo>(downloads|static|api|plugin).*) {  
    proxy_pass http://octoprint/$pathinfo;                              
    proxy_set_header Host $host;                                        
  }                                                                     
  location /octoprint/webcam/ {                                         
    proxy_pass http://octoprintcam/;                                    
  }                                                                     
  location /octoprint/sockjs {                                          
     proxy_pass http://octoprint/sockjs; # NO trailing slash here!      
     proxy_http_version 1.1;                                            
     proxy_set_header Upgrade $http_upgrade;                            
     proxy_set_header Connection "upgrade";                             
     proxy_set_header Host $host:$server_port;                          
     proxy_set_header X-Real-IP $remote_addr;                           
  }                                                                     

Now, I would assume my pathinfo location would grab the example url and pass it to the correct location but alas, it does not work :frowning:

Any ideas what I'm doing wrong here?