0

this is my config file:


server {
        server_name songreccs.com;


        location /static {
                root /home/user/sonreccs/flaskrec/;
        }

        location / {
                proxy_pass http://localhost:8000;
                include /etc/nginx/proxy_params;
                proxy_redirect off;
        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/songreccs.com/fullchain.pem; # manage>
    ssl_certificate_key /etc/letsencrypt/live/songreccs.com/privkey.pem; # mana>
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
    if ($host = songreccs.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;
        server_name songreccs.com;
    return 404; # managed by Certbot


}

server {
    if ($host = www.songreccs.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
        server_name www.songreccs.com;
    return 404; # managed by Certbot



    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/songreccs.com/fullchain.pem; # manage>
    ssl_certificate_key /etc/letsencrypt/live/songreccs.com/privkey.pem; # mana>
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}



before installing the certificate it was working. I am using Nginx as a reverse proxy for Gunicorn. Gunicorn is running a flask app in the background.

maltek
  • 3
  • 2
  • Have you updated the site URL in your application so that it starts with `https`? – Tero Kilkanen Jul 30 '22 at 12:30
  • hey! thanks for the comment! I reinstalled the certificates a couple of times and it somehow works now! However the static files aren't loading anymore. I copied the new file in the area above. I tried to change things up with "root" and "alias" and the trailing "/"´s in the paths of the location file, because that caused some trouble before installing the ssl certificate, but none of it helped.. Do you know why this would happen? – maltek Jul 31 '22 at 16:59
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 03 '22 at 10:43

1 Answers1

0

This was a question where I didn't knew what I was doing.

The config file had a serverblock that listened on port 443 and redirects to port 443, which most likely have been the issue.

maltek
  • 3
  • 2