设置 nginx 静态页面缓存

pull/2/head
李强 2021-03-15 20:31:48 +08:00
parent 8ec82e1a28
commit c301c9cda2
2 changed files with 14 additions and 0 deletions

View File

@ -27,6 +27,13 @@ server {
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 {

View File

@ -27,6 +27,13 @@ server {
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 {