实际部署Dify可能遇到的问题:忘记密码、开启HTTPS、知识库文档上传的大小限制和数量限制
背景
前面我们以 docker compose 容器化的方式本地部署了 Dify 社区版,并快速体验了其聊天助手、工作量编排以及智能体(Agent)功能。不过后续实际生产环境使用时遇到了忘记密码、如何开启SSL以支持HTTPS、如何突破知识库文档上传的大小限制和数量限制等问题。

遇到的问题
本地部署初始化后,忘记密码、密码错误如何重置?
这个问题官方文档里有写,在服务器上执行以下命令进行密码重置。
docker exec -it docker-api-1 flask reset-password
输入账户 email 以及两次新密码即可。
Note:一开始我并不知道官方文档提供了密码重置的方案,当时的第一想法是使用测试环境的密码覆盖生产环境的密码即可,便有了以下操作。
通过 docker-compose.yaml 以及 docker ps ,我们知道 Dify 用的是 PostgreSQL 数据库,不过默认没有开启远程访问,下面通过命令行来操作 PostgreSQL 数据库。
# 命令行连接PostgreSQL
[root@dify ~]# docker exec -it docker_db_1 /bin/bash
c84995ae10f8:/# psql -U postgres
psql (15.10)
Type "help" for help.# 列出所有数据库
postgres=# \lList of databasesName | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
-----------+----------+----------+------------+------------+------------+-----------------+-----------------------dify | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres +| | | | | | | postgres=CTc/postgrestemplate1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | libc | =c/postgres +| | | | | | | postgres=CTc/postgres
(4 rows)# 切换到dify数据库
postgres=# \c dify
You are now connected to database "dify" as user "postgres".# 查看所有数据表
dify=# \dList of relationsSchema | Name | Type | Owner
--------+-----------------------------------+----------+----------public | account_integrates | table | postgrespublic | accounts | table | postgrespublic | alembic_version | table | postgrespublic | api_based_extensions | table | postgrespublic | api_requests | table | postgrespublic | api_tokens | table | postgrespublic | app_annotation_hit_histories | table | postgrespublic | app_annotation_settings | table | postgrespublic | app_dataset_joins | table | postgrespublic | app_model_configs | table | postgrespublic | apps | table | postgrespublic | celery_taskmeta | table | postgrespublic | celery_tasksetmeta | table | postgrespublic | conversations | table | postgrespublic | data_source_api_key_auth_bindings | table | postgrespublic | data_source_oauth_bindings | table | postgrespublic | dataset_collection_bindings | table | postgrespublic | dataset_keyword_tables | table | postgrespublic | dataset_permissions | table | postgrespublic | dataset_process_rules | table | postgrespublic | dataset_queries | table | postgrespublic | dataset_retriever_resources | table | postgrespublic | datasets | table | postgrespublic | dify_setups | table | postgrespublic | document_segments | table | postgrespublic | documents | table | postgrespublic | embeddings | table | postgrespublic | end_users | table | postgrespublic | external_knowledge_apis | table | postgrespublic | external_knowledge_bindings | table | postgrespublic | installed_apps | table | postgrespublic | invitation_codes | table | postgrespublic | invitation_codes_id_seq | sequence | postgrespublic | load_balancing_model_configs | table | postgrespublic | message_agent_thoughts | table | postgrespublic | message_annotations | table | postgrespublic | message_chains | table | postgrespublic | message_feedbacks | table | postgrespublic | message_files | table | postgrespublic | messages | table | postgrespublic | operation_logs | table | postgrespublic | pinned_conversations | table | postgrespublic | provider_model_settings | table | postgrespublic | provider_models | table | postgrespublic | provider_orders | table | postgrespublic | providers | table | postgrespublic | recommended_apps | table | postgrespublic | saved_messages | table | postgrespublic | sites | table | postgrespublic | tag_bindings | table | postgrespublic | tags | table | postgrespublic | task_id_sequence | sequence | postgrespublic | taskset_id_sequence | sequence | postgrespublic | tenant_account_joins | table | postgrespublic | tenant_default_models | table | postgrespublic | tenant_preferred_model_providers | table | postgrespublic | tenants | table | postgrespublic | tidb_auth_bindings | table | postgrespublic | tool_api_providers | table | postgrespublic | tool_builtin_providers | table | postgrespublic | tool_conversation_variables | table | postgrespublic | tool_files | table | postgrespublic | tool_label_bindings | table | postgrespublic | tool_model_invokes | table | postgrespublic | tool_providers | table | postgrespublic | tool_published_apps | table | postgrespublic | tool_workflow_providers | table | postgrespublic | trace_app_config | table | postgrespublic | upload_files | table | postgrespublic | whitelists | table | postgrespublic | workflow_app_logs | table | postgrespublic | workflow_conversation_variables | table | postgrespublic | workflow_node_executions | table | postgrespublic | workflow_runs | table | postgrespublic | workflows | table | postgres
(75 rows)# 查看账户表
dify=# \d accountsTable "public.accounts"Column | Type | Collation | Nullable | Default
--------------------+-----------------------------+-----------+----------+-----------------------------id | uuid | | not null | uuid_generate_v4()name | character varying(255) | | not null | email | character varying(255) | | not null | password | character varying(255) | | | password_salt | character varying(255) | | | avatar | character varying(255) | | | interface_language | character varying(255) | | | interface_theme | character varying(255) | | | timezone | character varying(255) | | | last_login_at | timestamp without time zone | | | last_login_ip | character varying(255) | | | status | character varying(16) | | not null | 'active'::character varyinginitialized_at | timestamp without time zone | | | created_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP(0)updated_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP(0)last_active_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP(0)
Indexes:"account_pkey" PRIMARY KEY, btree (id)"account_email_idx" btree (email)# 查询所有用户记录
dify=# select * from accounts;id | name | email | password | password_salt | avatar | interface_language | interface_theme | timezone | last_login_at | last_login_ip | status | initialized_at | created_at | updated_at | last_active_at
--------------------------------------+-------+-------------------+------------------------------------------------------------------------------------------+--------------------------+--------+--------------------+-----------------+------------------+----------------------------+----------------+--------+----------------------------+---------------------+---------------------+--------------------------78837d37-83d0-4e21-88c0-25de52df8ee0 | Admin | you-guess@qq.com | OTYyYjZmNWFlMWI2MzIyZTU3ZWMyMjNmOGEzY2E0OTkwYmYxMzNmN2MzMTM2M2IyMzZlM2M0MDQyOTAyM2E1MQ== | 4bGygMJ7I7w6CLVXpEeRrA== | | en-US | light | America/New_York | 2024-12-07 08:24:27.715579 | 192.168.27.200 | active | 2024-12-07 08:24:06.685263 | 2024-12-07 08:24:07 | 2024-12-07 08:24:07 | 2024-12-22 08:00:40.2632
(1 row)
可以看到密码密文和盐值信息。接着使用一个已知密码的密文和盐值更新到 accounts 表;
从测试环境服务器上导出了 SQL 的 Insert 语句。
pg_dump -d dify -U postgres --column-inserts -t accounts -f /opt/accounts.sql
UPDATE public.accounts SET password='YmFjYWMwYWFkNTU2MDlmMmViNTZhNTc3N2JjZDBjMDk4ZWVmNjRjYjA2MGU4MzQ0YTZjNzViNjVhYzAyMzZhYg==', password_salt='j13XCIHXI4N2AK4yIJuggQ==' WHERE id='78837d37-83d0-4e21-88c0-25de52df8ee0';
改了密码密文和盐值后,依然登不上?
经过上述密码密文和盐值信息的替换后,还是没登上,不过错误信息是密码错误次数超限(默认锁定24小时)。这是因为当时忘记密码后,尝试了多次导致密码锁定。考虑到 Dify 用了 Redis ,而且一版这种密码次数错误限制我们也是通过 Redis 来实现,这里推测是 Redis 中有个用户被锁定的待超时时间的 Key 。直接打开 Dify 源码查看,果然~

找见了原因,直接连上 Redis ,删除这个 Key 即可。
[root@dify opt]# docker exec -it docker_redis_1 sh
/data # redis-cli
127.0.0.1:6379> keys *
1) "refresh_token:7d177d5971609013a2c8a5634ce49de1d488332bb5961d8d69ce1a371a3abdeac65d9010df7a6f1e7c73508cbd6733e0c27e2235999ca593192919678ab688b4"
2) "reset_password:account:78837d37-83d0-4e21-88c0-25de52df8ee0"
3) "account_refresh_token:78837d37-83d0-4e21-88c0-25de52df8ee0"
4) "login_error_rate_limit:you-guess@qq.com"# 查看过期时间,大概还剩23个多小时。。
127.0.0.1:6379> ttl login_error_rate_limit:you-guess@qq.com
(integer) 85202# 删除这个Key
127.0.0.1:6379> del login_error_rate_limit:you-guess@qq.com
(integer) 1
之后即可成功登录~~
本地部署80端口被占用应该如何解决?
一般的服务器上会有其他服务占用 80 端口,这时需要修改 .env 文件,指定 Nginx 暴露的端口。
# 编辑.env文件
EXPOSE_NGINX_PORT=9080
EXPOSE_NGINX_SSL_PORT=9443
如何开启SSL以支持HTTPS?
- 同样是编辑
.env文件,配置NGINX_HTTPS_ENABLED=true开启HTTPS; - 此外,还需要将证书文件放到
dify-main/docker/nginx/ssl目录下,记得命名为dify.crt与dify.key; - 然后
docker-compose down停止服务,最后启动服务docker-compose up -d生效。
NGINX_HTTPS_ENABLED=true

Note:
- 具体SSL的配置是参考docker-compose.yaml里面的环境变量得到的;
- 关于如何自签证书,参考:自签SSL证书配置Nginx代理Vue+SpringBoot前后端分离服务。
如何解决知识库文档上传的大小限制和数量限制?
同样是编辑 .env 文件, Dify 知识库文档上传单个文档最大是 15MB ,总文档数量限制 100 个。本地部署的社区版本可根据需要调整修改该限制。
# 上传文件大小限制,默认15M。
UPLOAD_FILE_SIZE_LIMIT=50M# 每次上传文件数上限,默认5个。
UPLOAD_FILE_BATCH_LIMIT=10
小总结
本文主要介绍了 Dify 本地部署后遇到的几个常见问题及其解决方案:首先是忘记密码的处理,可以通过官方提供的 flask reset-password 命令重置,或者直接操作 PostgreSQL 数据库修改密码信息;其次是密码错误次数超限导致账户锁定的问题,可以通过删除 Redis 中对应的限制 Key 来解决;再次是端口占用和 HTTPS 配置问题,可以通过修改 .env 文件中的 EXPOSE_NGINX_PORT 和 NGINX_HTTPS_ENABLED 等配置来解决;最后介绍了如何通过调整 .env 文件中的 UPLOAD_FILE_SIZE_LIMIT 和 UPLOAD_FILE_BATCH_LIMIT 参数来突破知识库文档上传的大小限制和数量限制。
Reference
- https://docs.dify.ai/zh-hans
If you have any questions or any bugs are found, please feel free to contact me.
Your comments and suggestions are welcome!
相关文章:
实际部署Dify可能遇到的问题:忘记密码、开启HTTPS、知识库文档上传的大小限制和数量限制
背景 前面我们以 docker compose 容器化的方式本地部署了 Dify 社区版,并快速体验了其聊天助手、工作量编排以及智能体(Agent)功能。不过后续实际生产环境使用时遇到了忘记密码、如何开启SSL以支持HTTPS、如何突破知识库文档上传的大小限制和…...
mugen
title: 走进 Mugen:性能测试领域的得力助手 date: ‘2024-12-30’ category: blog tags: Mugen性能测试开源项目系统评估 sig: QA archives: ‘2024-12’ author:way_back summary: Mugen 作为一款优秀的性能测试工具,以其丰富的功能、灵活的配置和精准…...
CannotRetrieveUpdates alert in disconnected OCP 4 cluster解决
环境: Red Hat OpenShift Container Platform (RHOCP) 4 问题: Cluster Version Operator 不断发送警报,表示在受限网络/断开连接的 OCP 4 集群中无法接收更新。 在隔离的 OpenShift 4 集群中看到 CannotRetrieveUpdates 警报: …...
计算机网络 (16)数字链路层的几个共同问题
一、封装成帧 封装成帧是数据链路层的一个基本问题。数据链路层把网络层交下来的数据构成帧发送到链路上,以及把接收到的帧中的数据取出并上交给网络层。封装成帧就是在一段数据的前后分别添加首部和尾部,构成了一个帧。接收端在收到物理层上交的比特流后…...
细说STM32F407单片机通过IIC读写EEPROM 24C02
目录 一、操作说明 二、工程配置 1、时钟、DEBUG、GPIO、USART6、NVIC、Code Generator 2、 IIC2 (1)Master Features组,主设备参数 (2)Slave Features组,从设备参数 三、软件设计 1、KELED 2、E…...
【AimRT】现代机器人通信中间件 AimRT
目录 一、什么是AimRT二、AimRT与ROS22.1 定位与设计2.2 组成与通信方式对比 三、AimRT基本概念3.1 Node、Pkg 和 Module3.2 Protocol、Channel、Rpc 和 Filter3.3 App模式 和 Pkg模式3.4 Executor3.5 Plugin 一、什么是AimRT AimRT 是智元机器人公司自主研发的一款机器人通信…...
Unity 读Excel,读取xlsx文件解决方案
Unity读取表格数据 效果: 思路: Unity可以解析Json,但是读取Excel需要插件的帮助,那就把这个功能分离开,读表插件就只管读表转Json,Unity就只管Json解析,中间需要一个存储空间,使用…...
R基于贝叶斯加法回归树BART、MCMC的DLNM分布滞后非线性模型分析母婴PM2.5暴露与出生体重数据及GAM模型对比、关键窗口识别
全文链接:https://tecdat.cn/?p38667 摘要:在母婴暴露于空气污染对儿童健康影响的研究中,常需对孕期暴露情况与健康结果进行回归分析。分布滞后非线性模型(DLNM)是一种常用于估计暴露 - 时间 - 响应函数的统计方法&am…...
【信息系统项目管理师】高分论文:论信息系统项目的沟通管理(信息管理服务一体化平台)
更多内容请见: 备考信息系统项目管理师-专栏介绍和目录 文章目录 论文一、事预则立,规划沟通管理二、提升支持,管理沟通三、观察偏差,监督沟通论文 2022年2月,我公司承建某省退役军人信息管理服务一体化平台项目,由于本人具有较丰富的项目管理经验,同时也是一名退伍军人…...
物联网工厂可视化监控平台:为智能制造打造的可视化大屏
01行业背景 随着技术的不断进步,物联网(IoT)已经成为推动数字化转型的核心力量。物联网通过连接各种设备和传感器,实现数据的实时收集、传输和分析,为各行各业带来了革命性的变化。随着5G、云计算、大数据等技术的成熟…...
3、redis的高可用
主从复制 主从复制:这是redis高可用的基础。哨兵模式和集群都是建立在此基础之上。 主从模式和数据库的主从模式是一样的,主负责写入,然后把写入的数据同步到从,从节点只能读不能写。read only。 不能做高可用的切换ÿ…...
数据结构--顺序表(详解)
欢迎大家来到我的博客~欢迎大家对我的博客提出指导,有错误的地方会改进的哦~点击这里了解更多内容 目录 一、线性表二、顺序表 一、线性表 线性表(linear list)是n个具有相同特性的数据元素的有限序列。 线性表是一种在实际中广泛使用的数据结…...
Day62 图论part11
Floyd 算法精讲 Floyd 算法代码很简单,但真正理解起原理 还是需要花点功夫,大家在看代码的时候,会发现 Floyd 的代码很简单,甚至看一眼就背下来了,但我为了讲清楚原理,本篇还是花了大篇幅来讲解。 代码随想…...
git clone 超时
git clone 超时 参考 https://blog.csdn.net/qq_45906972/article/details/142214187?utm_mediumdistribute.pc_relevant.none-task-blog-2defaultbaidujs_baidulandingword~default-0-142214187-blog-137158358.235v43pc_blog_bottom_relevance_base8&spm1001.2101.3001.…...
WPF编程excel表格操作
WPF编程excel表格操作 摘要NPOI安装封装代码测试代码 摘要 Excel操作几种方式 使用开源库NPOI(常用,操作丰富)使用Microsoft.Office.Interop.Excel COM组件(兼容性问题)使用OpenXml(效率高)使用OleDb(过时) NPOI安装 封装代码 using System; using System.IO; u…...
Day10补代码随想录 理论基础|232.用栈实现队列|225.用队列实现栈|20.有效的括号|1047.删除字符串中的所有相邻重复项
栈和队列理论基础 抽象认识 栈是先进后出(FIFO),队列是先进先出(LIFO) 队首(先进))队尾(后进)栈顶(后进)栈底(先进) 栈(Stack) 只在一端进行进出操作(只在一端进一端出)像个篮球框,取用篮球从一端进出。 /进栈 int a[1000];//足够大的栈空间 int top-1…...
【Devops】什么是Devops?(Development+Operations)和运维的区别?
DevOps(Development Operations)是一种将开发(Development)和运维(Operations)团队结合在一起的文化和实践,目的是通过自动化、协作和持续反馈来加快软件的开发、部署和运维的周期,…...
基于NodeMCU的物联网电灯控制系统设计
最终效果 基于NodeMCU的物联网电灯控制系统设计 小程序关灯 上图展现了小程序关灯过程的数据传输过程:用户下达关灯指令→小程序下发关灯指令→MQTT服务器接收关灯指令→下位机接收与处理关灯指令。 项目介绍 该项目是“物联网实验室监测控制系统设计(…...
Linux驱动开发 IIC I2C驱动 编写APP访问EEPROM AT24C02
在嵌入式开发中,I2C(Inter-Integrated Circuit)是一种常用的串行通信协议,广泛应用于与外设(如 EEPROM、传感器、显示屏等)进行数据交换。AT24C02 是一种常见的 I2C EEPROM 存储器,它提供 2Kbit…...
Linux应用软件编程-多任务处理(线程)
线程:轻量级的进程,线程的栈区独立(8M),与同一进程中的其他线程共用进程的堆区,数据区,文本区。 进程是操作系统资源分配的最小单位;线程是cpu任务调度的最小单位。 1. 线程的创建…...
安卓画廊管理工具:EhViewer开源应用全解析
安卓画廊管理工具:EhViewer开源应用全解析 【免费下载链接】EhViewer 🥥 A fork of EhViewer, feature requests are not accepted. Forked from https://gitlab.com/NekoInverter/EhViewer 项目地址: https://gitcode.com/GitHub_Trending/ehvi/EhVie…...
三步快速完成Windows和Office永久激活:KMS_VL_ALL_AIO完整指南
三步快速完成Windows和Office永久激活:KMS_VL_ALL_AIO完整指南 【免费下载链接】KMS_VL_ALL_AIO Smart Activation Script 项目地址: https://gitcode.com/gh_mirrors/km/KMS_VL_ALL_AIO 你是否曾经因为Windows或Office的激活问题而烦恼?当系统弹…...
终极指南:DGIOT物联网平台如何构建千万级设备接入的技术方案
终极指南:DGIOT物联网平台如何构建千万级设备接入的技术方案 【免费下载链接】dgiot Open source platform for iot , 6 min Quick Deployment,10M devices connection,Carrier level Stability;物联网开源平台,6分钟快速部署,千万级承载,电信级稳定性. Low code fo…...
Qwen3-TTS-VoiceDesign效果展示:会议纪要自动转语音+重点语句强调合成
Qwen3-TTS-VoiceDesign效果展示:会议纪要自动转语音重点语句强调合成 获取更多AI镜像 想探索更多AI镜像和应用场景?访问 CSDN星图镜像广场,提供丰富的预置镜像,覆盖大模型推理、图像生成、视频生成、模型微调等多个领域࿰…...
Dice Loss与mIoU在医学图像分割中的实战对比
1. 医学图像分割的挑战与评价指标选择 在医学影像分析领域,图像分割任务常常面临两个关键挑战:类别不平衡和边界模糊。以肿瘤分割为例,病灶区域可能只占整个CT图像的5%不到,而传统的交叉熵损失函数会让99%的阴性像素主导训练过程。…...
原神抽卡数据管理工具:从零开始的抽卡记录全掌控指南
原神抽卡数据管理工具:从零开始的抽卡记录全掌控指南 【免费下载链接】genshin-wish-export Easily export the Genshin Impact wish record. 项目地址: https://gitcode.com/GitHub_Trending/ge/genshin-wish-export 抽卡记录丢失怎么办?五星出货…...
罗技PUBG鼠标宏完整指南:终极无后坐力脚本配置方案
罗技PUBG鼠标宏完整指南:终极无后坐力脚本配置方案 【免费下载链接】logitech-pubg PUBG no recoil script for Logitech gaming mouse / 绝地求生 罗技 鼠标宏 项目地址: https://gitcode.com/gh_mirrors/lo/logitech-pubg 在绝地求生游戏中,后坐…...
实测分享:Retinaface+CurricularFace镜像,人脸识别准确率超乎想象
实测分享:RetinafaceCurricularFace镜像,人脸识别准确率超乎想象 1. 测试背景与目标 在当今数字化时代,人脸识别技术已成为身份验证、安防监控和智能设备交互的核心组件。然而,面对市场上众多的人脸识别解决方案,开发…...
seo网络培训都有哪些就业方向
SEO网络培训的就业方向有哪些? 随着互联网的迅速发展,SEO网络培训成为越来越多人关注的职业选择。SEO(搜索引擎优化)作为数字营销的重要组成部分,已经深深融入了各行各业的运营模式中。SEO网络培训究竟有哪些就业方向…...
艾尔登法环帧率解锁终极指南:告别60FPS限制的完整方案
艾尔登法环帧率解锁终极指南:告别60FPS限制的完整方案 【免费下载链接】EldenRingFpsUnlockAndMore A small utility to remove frame rate limit, change FOV, add widescreen support and more for Elden Ring 项目地址: https://gitcode.com/gh_mirrors/el/Eld…...
