补充安全的项目与部署说明
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
# 服务器部署说明
|
||||
|
||||
## 1. 获取代码
|
||||
|
||||
```bash
|
||||
git clone https://git.aiameiba.com/amb/aiameiba_com_new.git
|
||||
cd aiameiba_com_new
|
||||
```
|
||||
|
||||
## 2. 配置后端
|
||||
|
||||
复制环境变量模板并填写服务器配置:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
`.env` 至少需要配置:
|
||||
|
||||
```dotenv
|
||||
PORT=24731
|
||||
DB_CLIENT=mysql
|
||||
DB_HOST=47.109.98.44
|
||||
DB_PORT=33306
|
||||
DB_NAME=aiameiba_com_new
|
||||
DB_USER=admin
|
||||
DB_PASSWORD=请填写MySQL密码
|
||||
ADMIN_INITIAL_PASSWORD=请设置管理员初始密码
|
||||
NODE_ENV=production
|
||||
```
|
||||
|
||||
初始化数据库并启动后端:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run migrate
|
||||
npm start
|
||||
```
|
||||
|
||||
后端地址:`http://服务器IP:24731`
|
||||
|
||||
## 3. 配置前端
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
```
|
||||
|
||||
创建 `frontend/.env.local`:
|
||||
|
||||
```dotenv
|
||||
API_URL=http://127.0.0.1:24731
|
||||
NEXT_PUBLIC_SITE_URL=http://服务器IP:28642
|
||||
PORT=28642
|
||||
```
|
||||
|
||||
构建并启动:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run build
|
||||
npm start
|
||||
```
|
||||
|
||||
前端地址:`http://服务器IP:28642`
|
||||
|
||||
## 4. 后台管理
|
||||
|
||||
后台地址为部署域名下的 `/admin`。管理员登录信息请通过安全渠道配置或获取,登录后应立即修改密码。`.env`、`.env.local`、数据库文件和构建缓存不会提交到仓库。
|
||||
|
||||
## 5. 推荐进程管理
|
||||
|
||||
可以使用 PM2 分别管理前后端:
|
||||
|
||||
```bash
|
||||
pm2 start src/index.js --name aiameiba-api
|
||||
pm2 start npm --name aiameiba-web -- start
|
||||
pm2 save
|
||||
```
|
||||
|
||||
执行第二条命令前请确认当前目录为 `frontend`。
|
||||
@@ -0,0 +1,117 @@
|
||||
# 阿美巴 AI 官网
|
||||
|
||||
阿美巴 AI 官网是面向 AI 时代企业进化的官方网站和内容管理平台,包含前台展示、后台管理、知识实体模型、内容 API 和 MySQL 数据库迁移能力。
|
||||
|
||||
## 功能
|
||||
|
||||
- 官网页面:阿美巴、企业进化、四大价值、A/M-B、能力地图、案例、知识中心、FAQ、联系我们。
|
||||
- 按前台页面管理文字:标题、区块说明、联系方式、服务项目等。
|
||||
- 新增和编辑文章、案例、FAQ、企业能力及服务内容。
|
||||
- 管理员登录、修改密码。
|
||||
- 页脚邮箱、电话、地址、版权文字和 ICP 备案号管理。
|
||||
- SEO、面包屑、JSON-LD、站点地图和 robots 配置。
|
||||
|
||||
## 技术架构
|
||||
|
||||
- 后端:Node.js、Express、MySQL、Joi、UUID、crypto.scrypt。
|
||||
- 前端:Next.js 14 App Router、React 18、TypeScript、原生 CSS。
|
||||
- 数据库:MySQL,默认后端端口为 `24731`,前端端口为 `28642`。
|
||||
|
||||
## 项目结构
|
||||
|
||||
```text
|
||||
├── src/ # 后端源码、模型、API 路由、迁移脚本
|
||||
├── frontend/ # Next.js 前端和后台管理页面
|
||||
│ ├── public/images/ # Logo 和 ICP 备案徽章
|
||||
│ └── src/app/ # 前台页面、后台和全局布局
|
||||
├── public/images/ # 项目公共图片资源
|
||||
├── tests/ # 后端测试
|
||||
├── DEPLOY.md # 服务器部署说明
|
||||
├── .env.example # 环境变量模板
|
||||
└── README.md # 项目说明
|
||||
```
|
||||
|
||||
## 本地运行
|
||||
|
||||
### 后端
|
||||
|
||||
```bash
|
||||
npm install
|
||||
copy .env.example .env
|
||||
npm run migrate
|
||||
npm run dev
|
||||
```
|
||||
|
||||
后端地址:`http://localhost:24731`
|
||||
|
||||
### 前端
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm install
|
||||
```
|
||||
|
||||
创建 `frontend/.env.local`:
|
||||
|
||||
```dotenv
|
||||
API_URL=http://localhost:24731
|
||||
NEXT_PUBLIC_SITE_URL=http://localhost:28642
|
||||
PORT=28642
|
||||
```
|
||||
|
||||
启动前端:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
前台地址:`http://localhost:28642`
|
||||
|
||||
## 后台管理
|
||||
|
||||
后台地址:`http://localhost:28642/admin`
|
||||
|
||||
- 默认用户名:`admin`
|
||||
|
||||
后台登录信息请通过安全渠道获取,登录后应立即修改密码。页面文字在“首页与站点文字”中按前台页面选择;文章、案例、FAQ、能力和服务等可重复内容可以新增或编辑。
|
||||
|
||||
## 服务器部署
|
||||
|
||||
完整流程请查看 [DEPLOY.md](./DEPLOY.md)。基本命令:
|
||||
|
||||
```bash
|
||||
git clone https://git.aiameiba.com/amb/aiameiba_com_new.git
|
||||
cd aiameiba_com_new
|
||||
npm install
|
||||
cp .env.example .env
|
||||
# 编辑 .env 后执行
|
||||
npm run migrate
|
||||
npm start
|
||||
```
|
||||
|
||||
前端另开终端执行:
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm install
|
||||
npm run build
|
||||
npm start
|
||||
```
|
||||
|
||||
## 测试
|
||||
|
||||
```bash
|
||||
npm test
|
||||
cd frontend
|
||||
npm run build
|
||||
```
|
||||
|
||||
## 安全说明
|
||||
|
||||
`.env`、`frontend/.env.local`、数据库文件、日志、`node_modules` 和 `.next` 已加入 Git 忽略规则。部署后请立即修改后台默认密码,并限制 MySQL 公网访问范围。
|
||||
|
||||
## 远程仓库
|
||||
|
||||
`https://git.aiameiba.com/amb/aiameiba_com_new`
|
||||
|
||||
© 2026 阿美巴 AI
|
||||
Reference in New Issue
Block a user