初始化仓库及v1.0.0提交
This commit is contained in:
71
docs/DEPLOY.md
Normal file
71
docs/DEPLOY.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# 部署指南
|
||||
|
||||
## 宝塔面板部署
|
||||
|
||||
### 1. 环境准备
|
||||
|
||||
在宝塔面板"软件商店"中安装:
|
||||
- Nginx 1.22+
|
||||
- PHP 8.0(在 PHP 设置中确保以下扩展已启用:pdo_mysql、curl、mbstring、json、openssl)
|
||||
- MySQL 5.7 或 8.0
|
||||
|
||||
### 2. 创建网站
|
||||
|
||||
1. 网站 → 添加站点
|
||||
2. 填写域名
|
||||
3. PHP 版本选择 **PHP 8.0**
|
||||
4. 数据库选择"不创建"
|
||||
|
||||
### 3. 部署代码
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/your-domain.com
|
||||
git clone <repository-url> .
|
||||
composer install
|
||||
```
|
||||
|
||||
### 4. 设置权限
|
||||
|
||||
```bash
|
||||
chmod -R 755 .
|
||||
chown -R www:www .
|
||||
```
|
||||
|
||||
### 5. 配置 Nginx
|
||||
|
||||
1. 站点设置 → 网站目录 → 运行目录改为 `/public`
|
||||
2. 站点设置 → 配置文件 → 添加 `docs/baota-nginx-snippet.conf` 中的配置
|
||||
|
||||
### 6. 运行安装向导
|
||||
|
||||
访问 `http://your-domain.com/install.php`
|
||||
|
||||
### 7. SSL 配置(可选)
|
||||
|
||||
站点设置 → SSL → Let's Encrypt → 申请证书
|
||||
|
||||
## 手动部署
|
||||
|
||||
### Nginx 配置
|
||||
|
||||
参考 `docs/nginx.conf` 文件,将 `root` 指向 `public/` 目录。
|
||||
|
||||
### PHP-FPM 配置
|
||||
|
||||
确保 PHP-FPM 监听 socket 配置正确(通常为 `/tmp/php-cgi-80.sock` 或 `127.0.0.1:9000`)。
|
||||
|
||||
### 目录权限
|
||||
|
||||
```bash
|
||||
chown -R www-data:www-data /path/to/ai-chat
|
||||
chmod 755 /path/to/ai-chat/uploads
|
||||
chmod 755 /path/to/ai-chat/config
|
||||
```
|
||||
|
||||
## 安全建议
|
||||
|
||||
1. 配置 SSL 证书(HTTPS)
|
||||
2. 修改数据库默认端口
|
||||
3. 定期更新 PHP 和 Nginx 版本
|
||||
4. 限制 uploads 目录的执行权限
|
||||
5. 禁止访问 app/、config/、vendor/ 等非公开目录(已在 Nginx 配置中设置)
|
||||
Reference in New Issue
Block a user