0
votes

I'm worried that this question may be one that could be answered very simply if I just knew what to look for, so I apologise if this is something that's been addressed

I've set up a production web server for a Django app using nginx and uwsgi. It's got a let's encrypt SSL certificate installed, and now I'd like to automate the renewal.

I used the method referenced in this article to add the certificate: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 by adding the .well-known directory to the server block.

location ~ /.well-known {
            allow all;
    }

I've tried to keep this but the /.well-known is now 403 forbidden from nginx when the rest of the server config is added (provided below)

Can anyone tell me what I've done wrong or how to solve this?

here's the server config file:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name www.website.co.uk;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    include snippets/ssl-website.co.uk.conf;
    include snippets/ssl-params.conf;

    location /.well-known/ {
        root /home/user/website;
        allow all;
     }

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /home/user/website;
    }

    location / {
        include         uwsgi_params;
        uwsgi_pass  unix:/home/user/website/website.sock;
    }
}

Thanks in advance. I'm still quite new to this and trying to learn.

1

1 Answers

0
votes

i had a similar problem. This answer was my solution. https://stackoverflow.com/a/38949101/4098053

I hope this will help you too!