## 将HTTP请求全部重定向至HTTPS
server {
    listen       80;
    server_name  daily.demo.django-vue-admin.com;
    charset utf-8;
    access_log /var/log/nginx/daily.demo-80.access.log;
    error_log  /var/log/nginx/daily.demo-80.error.log;
    rewrite ^(.*)$ https://${server_name}$1 permanent;
}
server {
        listen 443 ssl;
        server_name daily.demo.django-vue-admin.com;
        root /vadmin-doc/;#项目路径
        charset utf-8;
        ssl_certificate    /nginx/keys/daily.demo.django-vue-admin.com.crt;#.pem证书路径
        ssl_certificate_key  /nginx/keys/daily.demo.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.demo;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        location / {
            try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
            root   /dvadmin-ui/dist/;
            add_header  Cache-Control  max-age=no-cache;
            index  index.html index.php index.htm;
        }
        location ~* \.(css|js|png|jpg|jpeg|gif|gz|svg|mp4|ogg|ogv|webm|htc|xml|woff)$ {
            access_log off;
            add_header Cache-Control max-age=604800;
            root   /dvadmin-ui/dist/;
            index  index.html index.php index.htm;
        }
        location @router {
            rewrite ^.*$ /index.html last;
        }
        access_log  /var/log/nginx/daily.demo-443.access.log;
        error_log   /var/log/nginx/daily.demo-443.error.log;
    }
