Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

打包路径问题 #209

Closed
5 of 6 tasks
MateSoftware2023 opened this issue Jul 22, 2023 · 1 comment
Closed
5 of 6 tasks

打包路径问题 #209

MateSoftware2023 opened this issue Jul 22, 2023 · 1 comment

Comments

@MateSoftware2023
Copy link

Related plugins

Description

vite 打包默认base 是/
如果用户放在某个目录下,通过目录路径访问不到 ,必须打包时指定目录名称,用户在以相同的目录命名
如何打包能,不管用户命名什么样的目录,都能通过路径 + 自定义目录名访问项目

Suggested solution

我使用nginx 配置,第一个locaction能访问到 , 第二个location如何访问都访问不到 ,只要/后面带路径名的,在本地直接访问dist目录只显示文件

location / {
root /usr/local/nginx/html/home;
try_files $uri $uri/ /index.html;
}

location /backend {
rewrite ^/backend/(.*)$ $1 break;
# alias /usr/local/nginx/html/backend/;
# root /usr/local/nginx/html/backend;
# root /usr/local/nginx/html/home;
# try_files $uri $uri/ /index.html;
index index.html;
}

Alternative

No response

Additional context

No response

Validations

@MateSoftware2023
Copy link
Author

已经解决

@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant