Django and SSL question

前端 未结 3 425
闹比i
闹比i 2020-12-07 19:33

I am planning to sell products by charging credit cards thus using SSL will be critical for Django-powered website. And I am very naive for this.

My initial django s

3条回答
  •  醉梦人生
    2020-12-07 20:07

    For those coming through Google, heres an example config for Nginx:

    server {
        listen 443 ssl default;
        server_name example.com;
        ssl on;
        ssl_certificate /etc/nginx/server.crt;
        ssl_certificate_key /etc/nginx/server.key;
        add_header  Cache-Control "public, must-revalidate";
        # add_header  Cache-Control "no-cache";
        expires     1d;
        add_header Strict-Transport-Security "max-age=2592000; includeSubdomains";
    
        location / {
            fastcgi_pass   localhost:8000;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param REQUEST_METHOD $request_method;
            fastcgi_param CONTENT_TYPE $content_type;
            fastcgi_param CONTENT_LENGTH $content_length;
            fastcgi_param  SERVER_PORT        $server_port;
            fastcgi_param  SERVER_NAME        $server_name;
            fastcgi_param  SERVER_PROTOCOL    $server_protocol;
            fastcgi_pass_request_headers on;
            # include fastcgi_params;
        }
    
        location /static {
            root /home/myapp/application;
        }
    
        location = /favicon.ico {
            root /home/myapp/application/assets;
            access_log off;
            log_not_found off;
        }
    
    }
    

提交回复
热议问题