Report this

What is the reason for this report?

What's webroot path to use with Django for Letsencrypt?

Posted on October 16, 2016

I have two sites enabled conf. Both are working (somewhat). I only changed the ip address and site domain name.

The configuration below gives me my Django site. I don’t have a homepage so it shows the Nginx default.

server {
    listen 80;
    server_name 122.122.122.122;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /webapps/;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/webapps/sym_torb/run/gunicorn.sock;
    }

}

The configuration below gives me an https site but with Gateway 404 in place of my Django URLs. I still see the Nginx default site.


server {
    listen 80;
    server_name site.com;
    return 301 https://$server_name$request_uri;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /webapps/;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/webapps/sym_torb/run/gunicorn.sock;
    }

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

server {

    # SSL configuration

    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    include snippets/ssl-site.com.conf;
    include snippets/ssl-params.conf;

}

I followed the tutorial below without modifying a single line: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-14-04

sudo letsencrypt certonly ‐a webroot ‐‐webroot‐path=/var/www/html ‐d example.com ‐d www.example.com

I have reason to believe that the above line should have been modified to for django or python environment. My path goes like this: /webapps/pythonenv/djangoproject/.

Or maybe not. Thank you for your time.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I’m having the same issue. How can I renew certificates by cron?

Check this out for Nginx and Ubuntu 14.04 trusty https://certbot.eff.org/#ubuntutrusty-nginx Super Easy. Automated. Use this instead.

Were you able to solve this? I’m having the same issue.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.