Appearance
安装
Dify提供了完善的中文文档,本项目不提供详细使用方法。下面只介绍本项目开发过程中遇到的几个浅层次问题,如遇其他问题请按照以下方法解决。
- Dify官方中文文档
- Dify Github Issue
- Google搜索Dify相关问题,也可使用AI模式进行搜索
- Chatgpt,各个AI都存在AI幻觉,注意甄别。
丑话说在前头
- 网站涉及【科学上网】,程序员不会【科学上网】请出门左转换个工作,或可询问群主索要自用梯子链接,自行购买使用。非推广,其他不负责。
- 网站涉及英文,程序员不认识英文相当于不认字,请自行翻译解决,不提供翻译服务。
- !!!以下文档请逐字阅读,更加详细的文档均可在官方文档中找到,不提供陪读服务!!!
1、获取源码
最新版源码,其他版本前往release查看。
sh
# github
git clone https://github.com/langgenius/dify.git
# gitee,非官方仓库,定时同步github,可能非最新源码。任选一个,别都执行。
git clone https://gitee.com/dify_ai/dify.git2、进入Dify目录
sh
cd dify/docker3、配置文件(可选)
本地部署时可忽略,有默认配置。服务器部署时必须!!!环境变量配置参考链接
sh
cp .env.example .envWARNING
默认端口为80,若端口冲突请修改.env文件中的EXPOSE_NGINX_PORT,及相应的SERVICE_API_URL、APP_WEB_URL。
4、备份数据(可选)
sh
# 备份volumes文件,映射出来的数据都存在这。可用于Dify升级之后版本存在BUG,降级使用。
tar -cvf volumes-$(date +%s).tgz volumes5、启动服务
会拉取dify的docker镜像,速度慢或失败的话请配置docker源或【科学上网】。
sh
docker compose up -dsh
docker-compose up -dWARNING
如果启动时遇见以下错误
2025/11/26 11:37:57 /app/internal/db/pg/pg.go:30
[error] failed to initialize database, got error failed to connect to `host=db_postgres user=postgres database=dify_plugin`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving)
2025/11/26 11:37:57 /app/internal/db/pg/pg.go:34
[error] failed to initialize database, got error failed to connect to `host=db_postgres user=postgres database=postgres`: hostname > resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving)
2025/11/26 11:37:57 init.go:99: [PANIC]failed to init dify plugin db: failed to connect to `host=db_postgres user=postgres database=postgres`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving)
panic: [PANIC]failed to init dify plugin db: failed to connect to `host=db_postgres user=postgres database=postgres`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving)使用以下命令运行
sh
docker compose --profile postgresql up -dDANGER
其他启动错误请在Dify官方文档或Github Issue中搜索。