Question

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

Posted October 12, 2016 4.6k views
Nginx

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

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.

×
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 139.59.31.252:8000 fail_timeout=0;
    }
    server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;
    
    #    server_name 139.59.31.252:8000;
        server_name operationscentral.co www.operationscentral.co;
    
    
        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;
        }
    }
    
    
    
    
Submit an Answer