如何配置nginx支持vue打包生成的静态资源路径?

2026-05-20 22:221阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计106个文字,预计阅读时间需要1分钟。

如何配置nginx支持vue打包生成的静态资源路径?

在Vue打包中设置publicPath:- publicPath: '/sjhjWeb/' (当NODE_ENV等于production时)- nginx配置: - listen 9404; - server { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; }

vue打包的publicPath:

publicPath: process.env.NODE_ENV === "production" ? "/sjhjWeb/" : "/",

nginx 的配置:

如何配置nginx支持vue打包生成的静态资源路径?

http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 9404; server_name localhost; location /sjhjWeb { alias D:/workspace/LW/yibiaosanshi-cloud2/platform-admin-ui/dist/; index index.html index.htm: # root D:/workspace/LW/yibiaosanshi-cloud2/platform-admin-ui/dist; try_files $uri $uri/ /sjhjWeb/index.html; } } }

访问: ip:9404/sjhjWeb

标签:路径vue

本文共计106个文字,预计阅读时间需要1分钟。

如何配置nginx支持vue打包生成的静态资源路径?

在Vue打包中设置publicPath:- publicPath: '/sjhjWeb/' (当NODE_ENV等于production时)- nginx配置: - listen 9404; - server { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; }

vue打包的publicPath:

publicPath: process.env.NODE_ENV === "production" ? "/sjhjWeb/" : "/",

nginx 的配置:

如何配置nginx支持vue打包生成的静态资源路径?

http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 9404; server_name localhost; location /sjhjWeb { alias D:/workspace/LW/yibiaosanshi-cloud2/platform-admin-ui/dist/; index index.html index.htm: # root D:/workspace/LW/yibiaosanshi-cloud2/platform-admin-ui/dist; try_files $uri $uri/ /sjhjWeb/index.html; } } }

访问: ip:9404/sjhjWeb

标签:路径vue