0
点赞
收藏
分享

微信扫一扫

Nginx配置vue项目模版

你的益达233 2023-04-25 阅读 68

1、hash模式时(#),nginx配置方法

    location ~ ^/test/cms-h5/{
        rewrite ^/test/cms-h5(.*)$ $1break;
        root/opt/nginx/web/cms-h5/dist;
    }

2、hisotry模式时,nginx配置方法

   location ~ ^/test/cms-h5/{
        try_files $uri@cms-h5;
    }
   location@cms-h5{
        rewrite ^/test/cms-h5(.*)$ $1break;
        try_files $uri /test/cms-h5/$uri//test/cms-h5/index.html;
        root/opt/nginx/web/plus/cms-h5/dist;
    }
或者
    location ~ ^/test/cms-h5/{
        rewrite ^/test/cms-h5(.*)$ $1break;
        try_files $uri /test/cms-h5/$uri//test/cms-h5/index.html;
        root/opt/nginx/web/plus/cms-h5/dist;
    }

3、备注

# 对于对象存储类的域名配置,建议增加请求头
通用配置(后端由nginx代理到minio)
    rewrite  ^/(.*).(svg|tif|tiff|wbmp|png|bmp|fax|gif|ico|jfif|jpe|jpeg|jpg|woff|cur|webp|swf|ttf|eot|woff2|css|js|txt|json|xhtml|html|map|rplib)$ /frontend/game/page/$1.$2 last;
    rewrite  ^/(.*)/? /frontend/game/page/index.html last;
    location / {
        if ($request_method = POST){
          return 403;
        }
        if ($request_method = PUT){
          return 403;
        }
        if ($request_method = DELETE){
          return 403;
        }
        proxy_set_header Host minio.herlly.cn;
        proxy_pass http://minio-nginx;
    }

举报

相关推荐

0 条评论