## 将HTTP请求全部重定向至HTTPS
server {
    listen       80;
    server_name  daily.api.django-vue-admin.com;
    charset utf-8;
    access_log /var/log/nginx/api-80.access.log;
    error_log  /var/log/nginx/api-80.error.log;
    rewrite ^(.*)$ https://${server_name}$1 permanent;
}
server {
        listen 443 ssl;
        server_name daily.api.django-vue-admin.com;
        root /dvadmin-backend/;#项目路径
        charset utf-8;
        ssl_certificate    /nginx/keys/daily.api.django-vue-admin.com.crt;#.pem证书路径
        ssl_certificate_key  /nginx/keys/daily.api.django-vue-admin.com.key;#.key证书路径
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        error_page 497  https://$host$request_uri;
        proxy_set_header Host $proxy_host;
        proxy_set_header X-DTS-SCHEMA daily.api;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        location / {
		root html/www;
            include uwsgi_params;
            uwsgi_pass dvadmin-django:8000;
            uwsgi_param UWSGI_SCRIPT home.wsgi;
            uwsgi_param UWSGI_CHDIR /dvadmin-backend/;#项目路径

        }
        # Django media
        location /media  {
                alias /dvadmin-backend/media;  # your Django project's media files - amend as required
            }
        # Django static
        location /static {
            alias /dvadmin-backend/static; # your Django project's static files - amend as required
        }

        access_log  /var/log/nginx/daily.api-443.access.log;
        error_log   /var/log/nginx/daily.api-443.error.log;
    }
