Files
integral-shop/docs/ecs-ssh-restart-webman.md
2026-05-27 13:00:32 +08:00

222 lines
3.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ECS 服务器 SSH 终端进入 Docker `integral-houtai` 重启 Webman
适用项目:池州雷蕾商贸 `czleilei240` 寄卖商城
适用容器:`integral-houtai`
适用域名:`https://leileiadmin.czchunfang.com`
## 先说结论
这套项目当前不是标准 ThinkPHP / `php think` 启动方式。
我已经核对过当前代码目录,实际应用文件只有:
```text
integral-resell/houtai/webman.bin
```
没有下面这些文件:
- `think`
- `start.php`
- `composer.json`
所以这套 `integral-houtai` 容器里,不能按 `php think` 命令去重启 Webman正确方式是进入容器后执行
```bash
./webman.bin restart -d
```
## 一、SSH 登录 ECS
在本地终端执行:
```bash
ssh root@116.62.83.240
```
如果 SSH 端口不是默认 `22`,则执行:
```bash
ssh -p 22 root@116.62.83.240
```
## 二、进入容器
登录服务器后,直接执行:
```bash
docker exec -it integral-houtai sh
```
进入容器后,提示符会切换到容器内部环境。
## 五、在容器内重启 Webman
进入容器后执行:
```bash
./webman.bin restart -d
```
如果你不确定当前目录,也可以写成:
```bash
cd /app
./webman.bin restart -d
```
## 六、退出容器
执行:
```bash
exit
```
## 七、查看日志确认是否启动成功
回到服务器宿主机终端后执行:
```bash
docker logs -f --tail 100 integral-houtai
```
看到类似下面的字样,说明 Webman 已成功拉起:
```text
Webman start success
```
看完日志后按 `Ctrl + C` 退出。
## 八、验证接口是否恢复
可以在服务器上直接验证:
```bash
curl -I http://127.0.0.1:18085
```
或者验证线上域名:
```bash
curl -I https://leileiadmin.czchunfang.com
```
如果要验证业务接口:
```bash
curl -s "https://leileiadmin.czchunfang.com/api/order/goods?page=1&limit=1"
```
## 九、完整操作示例
如果只是日常手动进入容器重启,整套命令如下:
```bash
ssh root@116.62.83.240
docker exec -it integral-houtai sh
pwd
cd /app
ls
./webman.bin restart -d
exit
docker logs -f --tail 100 integral-houtai
```
## 十、为什么不是 `php think`
因为当前这套项目不是通过 ThinkPHP 命令入口运行的。
我核对到的实际情况是:
- 容器挂载的应用目录是 `/app`
- 对应宿主机目录是 `/www/wwwroot/leileiadmin.czchunfang.com`
- 应用启动文件是 `webman.bin`
- 当前项目目录里不存在 `think` / `start.php`
所以如果你进入容器后执行类似:
```bash
php think
php think start
php think restart
```
大概率会提示文件不存在或命令不可用。
## 十一、按实际操作整理的最短步骤
```bash
ssh root@116.62.83.240
docker exec -it integral-houtai sh
cd /app
./webman.bin restart -d
exit
docker logs -f --tail 100 integral-houtai
```
## 十二、如果你一定要先验证容器里有没有 `think`
进入容器后可以手动检查:
```bash
cd /app
ls -la
find /app -maxdepth 2 -name think -o -name start.php
```
如果没有结果,就说明这套容器内确实不是 ThinkPHP 命令模式。
## 十三、进入 Redis 容器
Redis 容器名是:
```bash
integral-redis
```
进入容器执行:
```bash
docker exec -it integral-redis sh
```
如果想直接连 Redis也可以不进容器直接在宿主机执行
```bash
docker exec -it integral-redis redis-cli
```
## 十四、清空 Redis 数据
进入 Redis 容器后,先连上 redis
```bash
redis-cli
```
如果需要密码,执行:
```bash
redis-cli -a '你的Redis密码'
```
清空当前数据库:
```bash
FLUSHDB
```
清空所有数据库:
```bash
FLUSHALL
```
如果要一条命令直接清空当前库,也可以在宿主机执行:
```bash
docker exec -it integral-redis redis-cli -a '你的Redis密码' FLUSHDB
```