通过CompressionWebpackPlugin打包的gzip文件在nginx部署

一级路由配置方法

 

二级路由配置方法

location /h5 {
if ($request_filename ~* .*\.(?:htm|html)$)
{
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
if ($request_filename ~* .*\.(?:js|css)$)
{
expires 7d;
}
if ($request_filename ~* .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$)
{
expires 7d;
}
alias /www/project/h5/;
try_files $uri $uri/ @router;
index index.html index.htm;

}

location @router {
rewrite ^.*$ /h5/index.html last;
}

 

posted @ 2022-02-14 14:19  吃饭七分饱  阅读(115)  评论(0编辑  收藏  举报