docs: 📝 部署文案优化
This commit is contained in:
18
README.md
18
README.md
@@ -95,36 +95,34 @@ pnpm run dev
|
||||
|
||||
## 项目部署
|
||||
|
||||
[Nginx 安装和配置](https://blog.csdn.net/u013737132/article/details/145667694)
|
||||
执行 `pnpm run build` 命令后,项目将被打包并生成 `dist` 目录。接下来,将 `dist` 目录下的文件上传到服务器 `/usr/share/nginx/html` 目录下,并配置 Nginx 进行反向代理。
|
||||
|
||||
**项目打包**
|
||||
```bash
|
||||
pnpm run build
|
||||
# 生成文件将输出至 /dist 目录
|
||||
```
|
||||
|
||||
**部署静态资源**
|
||||
以下是 Nginx 的配置示例:
|
||||
|
||||
将本地打包生成的 dist 目录下的所有文件拷贝至服务器的 /usr/share/nginx/html 目录。
|
||||
|
||||
**Nginx 配置**
|
||||
```shell
|
||||
# nginx.cofig 配置
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
# 反向代理配置
|
||||
location /prod-api/ {
|
||||
# api.youlai.tech 替换后端API地址,注意保留后面的斜杠 /
|
||||
# 请将 api.youlai.tech 替换为您的后端 API 地址,并注意保留后面的斜杠 /
|
||||
proxy_pass http://api.youlai.tech/;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
更多详细信息,请参考这篇文章:[Nginx 安装和配置](https://blog.csdn.net/u013737132/article/details/145667694)。
|
||||
|
||||
## 本地Mock
|
||||
|
||||
项目同时支持在线和本地 Mock 接口,默认使用线上接口,如需替换为 Mock 接口,修改文件 `.env.development` 的 `VITE_MOCK_DEV_SERVER` 为 `true` **即可**。
|
||||
|
||||
Reference in New Issue
Block a user