How to remove ssl certificate(lets encrypt) from django application ?

October 12, 2016 74 views

I have integrated ssl certificate(letsencrypt) . how to remove ssl(https) from the django application ?

1 Answer

To disable https you will need to edit 1-2 files in /etc/nginx/sites-enabled.

There are likely to be two files here. One for http that redirects to https and your main configuration file which will support the https site and have your live configuration. If you can share the contents of these files here we can assist you in making the needed edits.

In general you will want to take some parts (document root, proxy_pass configurations in location blocks) from the https server{} section to move to the http server{} section of your configuration before removing the https server block and restarting nginx for the change to take effect. Without seeing your configuration files I cannot suggest the exact changes you'll want to make.

  • I have deleted all the "letsencrypt" directories and and changed the nginx-->sites-enabled-->django settings .. i have changed the setting as ,

    upstream app_server {
        server fail_timeout=0;
    server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;
    #    server_name;
        root /usr/share/nginx/html;
        index index.html index.htm;
        client_max_body_size 4G;
        server_name _;
        keepalive_timeout 5;
        # Your Django project's media files - amend as required
        location /media  {
            alias /home/django/django_project/django_project/media;
        # your Django project's static files - amend as required
        location /static {
            alias /home/django/Insights/staticfiles/;
        # Proxy the static assests for the Django Admin panel
        location /static/admin {
           alias /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin/;
     location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_pass http://app_server;
    • I am not seeing any red flags here in your configuration. Are you still having trouble after making these changes?

Have another answer? Share your knowledge.