[GH-ISSUE #978] 请教一个问题,为什么每次更换了nginx-ui的镜像后 之前直接挂载的数据 就没办法用了,必须走备份恢复逻辑吗? #7643

Closed
opened 2026-03-12 21:56:23 +03:00 by kerem · 18 comments
Owner

Originally created by @freshgeek on GitHub (Apr 21, 2025).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/978

请教一个问题,为什么每次更换了nginx-ui的镜像后 之前直接挂载的数据 就没办法用了,必须走备份恢复逻辑吗?

比如:我把整个nginx 、 nginx-ui 、 www 几个关键文件做了存储卷挂载

然后启动新的nginx-ui 镜像,版本不一致的话,同样的账号密码就无法登录进去了,只能重新初始化 拷贝文件?

Originally created by @freshgeek on GitHub (Apr 21, 2025). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/978 请教一个问题,为什么每次更换了nginx-ui的镜像后 之前直接挂载的数据 就没办法用了,必须走备份恢复逻辑吗? 比如:我把整个nginx 、 nginx-ui 、 www 几个关键文件做了存储卷挂载 然后启动新的nginx-ui 镜像,版本不一致的话,同样的账号密码就无法登录进去了,只能重新初始化 拷贝文件?
kerem closed this issue 2026-03-12 21:56:29 +03:00
Author
Owner

@0xJacky commented on GitHub (Apr 21, 2025):

不可能的,看看命令,你是不是挂载错文件夹了

<!-- gh-comment-id:2817435206 --> @0xJacky commented on GitHub (Apr 21, 2025): 不可能的,看看命令,你是不是挂载错文件夹了
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

我是参考文档中的 执行:
docker run -d --name=nginx --restart=always -v ./nginx:/etc/nginx -v ./nginx:/etc/nginx-ui -v ./nginx:/var/www -p 80:80 -p 443:443
我好像猜到原因了,是不是需要配置固定的 NGINX_UI_APP_JWT_SECRET

<!-- gh-comment-id:2817437929 --> @freshgeek commented on GitHub (Apr 21, 2025): 我是参考文档中的 执行: docker run -d --name=nginx --restart=always -v ./nginx:/etc/nginx -v ./nginx:/etc/nginx-ui -v ./nginx:/var/www -p 80:80 -p 443:443 我好像猜到原因了,是不是需要配置固定的 NGINX_UI_APP_JWT_SECRET
Author
Owner

@0xJacky commented on GitHub (Apr 21, 2025):

参考文档可不是让你三个文件夹都映射在同一个文件夹里,这样可能会有安全风险,你可以先试试分开文件夹来映射

<!-- gh-comment-id:2817439665 --> @0xJacky commented on GitHub (Apr 21, 2025): 参考文档可不是让你三个文件夹都映射在同一个文件夹里,这样可能会有安全风险,你可以先试试分开文件夹来映射
Author
Owner

@0xJacky commented on GitHub (Apr 21, 2025):

不需要,app.ini 里有写入就可以

<!-- gh-comment-id:2817440087 --> @0xJacky commented on GitHub (Apr 21, 2025): 不需要,app.ini 里有写入就可以
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

参考文档可不是让你三个文件夹都映射在同一个文件夹里,这样可能会有安全风险,你可以先试试分开文件夹来映射

嗯 这个不重名就不要紧,因为云服务不支持子目录,所以只能先挂一个下面,不然得创建三个挂载点

<!-- gh-comment-id:2817442434 --> @freshgeek commented on GitHub (Apr 21, 2025): > 参考文档可不是让你三个文件夹都映射在同一个文件夹里,这样可能会有安全风险,你可以先试试分开文件夹来映射 嗯 这个不重名就不要紧,因为云服务不支持子目录,所以只能先挂一个下面,不然得创建三个挂载点
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

不需要,app.ini 里有写入就可以

核对这个是相同的

<!-- gh-comment-id:2817446649 --> @freshgeek commented on GitHub (Apr 21, 2025): > 不需要,app.ini 里有写入就可以 核对这个是相同的
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

日志好像显示是: record not found

/root/workspace/__flow_work/__flow_builds/12c7912a-7c7d-42e8-9068-a84b6113d9a3/workspace/nginx-ui_9uNW/internal/user/login.go:14 record not found
[0.077ms] [rows:0] SELECT * FROM auths WHERE auths.name = "xx" AND auths.deleted_at IS NULL ORDER BY auths.id LIMIT 1
[GIN] 2025/04/21 - 01:18:15 | 403 | 87.864µs | 221.127.201.167 | GET "/api/notifications/live"
[GIN] 2025/04/21 - 01:18:15 | 403 | 160.395µs | 221.127.201.167 | GET "/api/notifications/live"
[GIN] 2025/04/21 - 01:18:20 | 403 | 65.697µs | 221.127.201.167 | GET "/api/notifications/live"

<!-- gh-comment-id:2817447670 --> @freshgeek commented on GitHub (Apr 21, 2025): 日志好像显示是: record not found /root/workspace/__flow_work/__flow_builds/12c7912a-7c7d-42e8-9068-a84b6113d9a3/workspace/nginx-ui_9uNW/internal/user/login.go:14 record not found [0.077ms] [rows:0] SELECT * FROM `auths` WHERE `auths`.`name` = "xx" AND `auths`.`deleted_at` IS NULL ORDER BY `auths`.`id` LIMIT 1 [GIN] 2025/04/21 - 01:18:15 | 403 | 87.864µs | 221.127.201.167 | GET "/api/notifications/live" [GIN] 2025/04/21 - 01:18:15 | 403 | 160.395µs | 221.127.201.167 | GET "/api/notifications/live" [GIN] 2025/04/21 - 01:18:20 | 403 | 65.697µs | 221.127.201.167 | GET "/api/notifications/live"
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

好像下发的公钥不一样 api/crypto/public_key ,但是看没有和环境相关,都是缓存10分钟轮转

Image
<!-- gh-comment-id:2817472073 --> @freshgeek commented on GitHub (Apr 21, 2025): 好像下发的公钥不一样 api/crypto/public_key ,但是看没有和环境相关,都是缓存10分钟轮转 <img width="1075" alt="Image" src="https://github.com/user-attachments/assets/d88a8dfa-7ac2-416b-b153-2d2fb3dddf4e" />
Author
Owner

@0xJacky commented on GitHub (Apr 21, 2025):

跟这个没关系,这个是安全性设计JackyOn Apr 21, 2025, at 9:50 AM, Chen.Chao @.> wrote:
好像下发的公钥不一样 api/crypto/public_key—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.
>

freshgeek left a comment (0xJacky/nginx-ui#978)
好像下发的公钥不一样 api/crypto/public_key

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

<!-- gh-comment-id:2817476554 --> @0xJacky commented on GitHub (Apr 21, 2025): 跟这个没关系,这个是安全性设计JackyOn Apr 21, 2025, at 9:50 AM, Chen.Chao ***@***.***> wrote: 好像下发的公钥不一样 api/crypto/public_key—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***> freshgeek left a comment (0xJacky/nginx-ui#978) 好像下发的公钥不一样 api/crypto/public_key —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
Author
Owner

@0xJacky commented on GitHub (Apr 21, 2025):

[0.077ms] [rows:0] SELECT * FROM auths WHERE auths.name = "xx" AND auths.deleted_at IS NULL ORDER BY auths.id LIMIT 1

说明数据库中没有这个 name 的记录

<!-- gh-comment-id:2817736310 --> @0xJacky commented on GitHub (Apr 21, 2025): ``` [0.077ms] [rows:0] SELECT * FROM auths WHERE auths.name = "xx" AND auths.deleted_at IS NULL ORDER BY auths.id LIMIT 1 ``` 说明数据库中没有这个 name 的记录
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

[0.077ms] [rows:0] SELECT * FROM auths WHERE auths.name = "xx" AND auths.deleted_at IS NULL ORDER BY auths.id LIMIT 1

说明数据库中没有这个 name 的记录

这个auth 应该是三方授权吧,用户在user表 ,问题是 login.go:14 这条没找到,但是从挂载的文件夹把数据库user表拉出来看是有数据的,名字从日志中可以看到是正确的,那么是否是密码hash 有问题,在不同平台上有差异?

<!-- gh-comment-id:2817740229 --> @freshgeek commented on GitHub (Apr 21, 2025): > ``` > [0.077ms] [rows:0] SELECT * FROM auths WHERE auths.name = "xx" AND auths.deleted_at IS NULL ORDER BY auths.id LIMIT 1 > ``` > > 说明数据库中没有这个 name 的记录 这个auth 应该是三方授权吧,用户在user表 ,问题是 login.go:14 这条没找到,但是从挂载的文件夹把数据库user表拉出来看是有数据的,名字从日志中可以看到是正确的,那么是否是密码hash 有问题,在不同平台上有差异?
Author
Owner

@0xJacky commented on GitHub (Apr 21, 2025):

额?你用的什么版本,我还没发布呢

<!-- gh-comment-id:2817743684 --> @0xJacky commented on GitHub (Apr 21, 2025): 额?你用的什么版本,我还没发布呢
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

额?你用的什么版本,我还没发布呢

老的镜像tag是 sha-c5ea44c
新的镜像是main 分支构建的

<!-- gh-comment-id:2817746205 --> @freshgeek commented on GitHub (Apr 21, 2025): > 额?你用的什么版本,我还没发布呢 老的镜像tag是 sha-c5ea44c 新的镜像是main 分支构建的
Author
Owner

@0xJacky commented on GitHub (Apr 21, 2025):

你是在新的 c5ea44c 镜像中安装了,然后回退到 main 分支构建的镜像了吗

<!-- gh-comment-id:2817750947 --> @0xJacky commented on GitHub (Apr 21, 2025): 你是在新的 c5ea44c 镜像中安装了,然后回退到 main 分支构建的镜像了吗
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

你是在新的 c5ea44c 镜像中安装了,然后回退到 main 分支构建的镜像了吗

嗯 那么说 main 是更老的吗

<!-- gh-comment-id:2817752295 --> @freshgeek commented on GitHub (Apr 21, 2025): > 你是在新的 [c5ea44c](https://github.com/0xJacky/nginx-ui/commit/c5ea44ca1e6b44f2173eec3b9baa6df115d8f61a) 镜像中安装了,然后回退到 main 分支构建的镜像了吗 嗯 那么说 main 是更老的吗
Author
Owner

@0xJacky commented on GitHub (Apr 21, 2025):

那没事,你等rc.6吧,要不就在 main 上再装一次。main 肯定是老的,但是我没发布之前 dev 不推荐在生产环境上使用,也不会提供降级回退的功能。

<!-- gh-comment-id:2817755140 --> @0xJacky commented on GitHub (Apr 21, 2025): 那没事,你等rc.6吧,要不就在 main 上再装一次。main 肯定是老的,但是我没发布之前 dev 不推荐在生产环境上使用,也不会提供降级回退的功能。
Author
Owner

@freshgeek commented on GitHub (Apr 21, 2025):

那没事,你等rc.6吧,要不就在 main 上再装一次。main 肯定是老的,但是我没发布之前 dev 不推荐在生产环境上使用,也不会提供降级回退的功能。

好的 ,那main 是稳定的线上吧

<!-- gh-comment-id:2817756674 --> @freshgeek commented on GitHub (Apr 21, 2025): > 那没事,你等rc.6吧,要不就在 main 上再装一次。main 肯定是老的,但是我没发布之前 dev 不推荐在生产环境上使用,也不会提供降级回退的功能。 好的 ,那main 是稳定的线上吧
Author
Owner

@0xJacky commented on GitHub (Apr 21, 2025):

是的

<!-- gh-comment-id:2817757912 --> @0xJacky commented on GitHub (Apr 21, 2025): 是的
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#7643
No description provided.