修改主机地址
This commit is contained in:
11
frontend/.env.production.example
Normal file
11
frontend/.env.production.example
Normal file
@@ -0,0 +1,11 @@
|
||||
# 前端生产环境配置
|
||||
# 构建时使用的环境变量
|
||||
|
||||
# API 基础 URL
|
||||
# Docker Compose 部署(前端独立构建,后端在 47.238.126.111:33001):
|
||||
VITE_API_BASE_URL=http://47.238.126.111:33001
|
||||
|
||||
# 传统部署(Nginx 反向代理):
|
||||
# VITE_API_BASE_URL=/api # 如果使用 Nginx 反向代理到后端,可以设置为相对路径 /api
|
||||
|
||||
# 其他环境变量可根据需要添加
|
||||
@@ -3,7 +3,7 @@ import axios from 'axios';
|
||||
const TOKEN_KEY = 'auth_token';
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001',
|
||||
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:33001',
|
||||
timeout: 15000,
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ export default defineConfig({
|
||||
port: 3000,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: process.env.VITE_API_URL || 'http://localhost:3001',
|
||||
target: process.env.VITE_API_URL || 'http://localhost:33001',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user