设置 nginx 静态页面缓存
parent
8ec82e1a28
commit
c301c9cda2
|
@ -27,6 +27,13 @@ server {
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
|
try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
|
||||||
root /dvadmin-ui/dist/;
|
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;
|
index index.html index.php index.htm;
|
||||||
}
|
}
|
||||||
location @router {
|
location @router {
|
||||||
|
|
|
@ -27,6 +27,13 @@ server {
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
|
try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
|
||||||
root /dvadmin-ui/dist/;
|
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;
|
index index.html index.php index.htm;
|
||||||
}
|
}
|
||||||
location @router {
|
location @router {
|
||||||
|
|
Loading…
Reference in New Issue