1. 程式人生 > >免費好用的阿裏雲雲盾證書服務(https證書)申請及Nginx配置

免費好用的阿裏雲雲盾證書服務(https證書)申請及Nginx配置

write man del remote worker work gen params 申請

購買

阿裏雲控制臺

技術分享圖片

然後

技術分享圖片

購買就可以了

Nginx配置

我直接把我的配置貼出來,其實這個在阿裏雲裏面介紹的有,就是找到https那裏,然後打開註釋,改一下配置就好了

user root;
worker_processes 1; 

error_log /app/log/nginx/error.log;
pid /var/run/nginx.pid;
 
events {
    worker_connections  1024; 
}
 
 
http {
    log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘
                      ‘$status $body_bytes_sent "$http_referer" ‘
                      ‘"$http_user_agent" "$http_x_forwarded_for"‘;
 
    access_log  /app/log/nginx/access.log  main;
 
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
 
    include             /app/nginx-1.12.2/conf/mime.types;
    default_type        application/octet-stream;
 
    upstream django { 
        server 127.0.0.1:8000;
    }
    server {
        listen      80; 
        server_name wengang.top; 
        charset     utf-8;
        client_max_body_size 75M;
        rewrite ^(.*) https://$server_name$1 permanent;   # 將80端口重定向到https
           }


   # HTTPS server
     server {
        listen       443 ssl;
        server_name  wengang.top;
        ssl on;
        ssl_certificate      ****.pem;  # 下載證書中的文件
        ssl_certificate_key  ****.key; # 下載證書中的文件

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers  on;

        charset     utf-8;

        # max upload size
        client_max_body_size 75M;
        location / {
             include     uwsgi_params;
             uwsgi_pass  django;
                }
        location /static{
             alias  /home/shi/allstatic;
                     }
    }
}

  

免費好用的阿裏雲雲盾證書服務(https證書)申請及Nginx配置