diff --git a/docker/nginx.conf b/docker/nginx.conf index 7f9e4c7..8445fc3 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -17,12 +17,14 @@ server { add_header Content-Type text/plain; } - location / { - alias /usr/share/nginx/html/; - index index.html; + location /h5/ { try_files $uri $uri/ /index.html; } + location = / { + return 301 /h5/; + } + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; diff --git a/vite.config.ts b/vite.config.ts index 96b95b6..9741e7d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -18,6 +18,7 @@ export default defineConfig(({ command, mode }): UserConfig => { const isBuild = process.env.NODE_ENV === 'production'; return { + base: '/h5/', // 自定义env目录 envDir: './env', resolve: {