Skip to content

部署环境变量#

基于文件的配置

您可以在单个变量后添加 _FILE 以在单独的文件中提供其配置。有关更多详细信息,请参阅在单独文件中保存敏感数据

本页列出了自托管 n8n 实例的部署配置选项,包括设置访问 URL、启用模板、自定义加密和配置服务器详细信息。

变量 类型 默认值 描述
HTTP_PROXY String - 代理未加密 HTTP 请求的 URL。设置后,n8n 将通过代理 URL 代理来自节点的所有未加密 HTTP 流量。
HTTPS_PROXY String - 代理 TLS/SSL 加密 HTTP 请求的 URL。设置后,n8n 将通过代理 URL 代理来自节点的所有 TLS/SSL 加密 HTTP 流量。
ALL_PROXY String - 代理未加密和加密 HTTP 请求的 URL。设置后,当更具体的变量(HTTP_PROXYHTTPS_PROXY)不存在时,n8n 使用此值。
NO_PROXY String - 应绕过代理的主机名或 URL 的逗号分隔列表。使用 HTTP_PROXYHTTPS_PROXYALL_PROXY 时,n8n 将直接连接到此处定义的 URL 或主机名,而不使用代理。
N8N_EDITOR_BASE_URL String - 用户可以访问编辑器的公共 URL。也用于从 n8n 发送的电子邮件和基于 SAML 身份验证的重定向 URL。
N8N_CONFIG_FILES (deprecated) String - 用于提供 JSON 配置文件的路径。此选项已弃用,将在未来版本中删除。请改用 .env 文件或 *_FILE 环境变量。
N8N_DISABLE_UI Boolean false 设置为 true 禁用 UI。
N8N_PREVIEW_MODE Boolean false 设置为 true 在预览模式下运行。
N8N_TEMPLATES_ENABLED Boolean false 启用 (true) 或禁用 (false) 工作流模板
N8N_TEMPLATES_HOST String https://api.n8n.io 如果创建自己的工作流模板库,请更改此设置。请注意,要使用自己的工作流模板库,您的 API 必须提供与 n8n 相同的端点和响应结构。请参阅工作流模板获取更多信息。
N8N_ENCRYPTION_KEY String Random key generated by n8n 提供用于在 n8n 数据库中加密凭据的自定义密钥。默认情况下,n8n 在首次启动时生成随机密钥。
N8N_USER_FOLDER String user-folder 提供 n8n 创建 .n8n 文件夹的路径。此目录存储用户特定数据,如数据库文件和加密密钥。
N8N_PATH String / n8n 部署的路径。
N8N_HOST String localhost n8n 运行的主机名。
N8N_PORT Number 5678 n8n 运行的 HTTP 端口。
N8N_LISTEN_ADDRESS String :: n8n 应该监听的 IP 地址。
N8N_PROTOCOL Enum string: http, https http The protocol used to reach n8n.
N8N_SSL_KEY String - The SSL key for HTTPS protocol.
N8N_SSL_CERT String - The SSL certificate for HTTPS protocol.
N8N_PERSONALIZATION_ENABLED Boolean true Whether to ask users personalisation questions and then customise n8n accordingly.
N8N_VERSION_NOTIFICATIONS_ENABLED Boolean true When enabled, n8n sends notifications of new versions and security updates.
N8N_VERSION_NOTIFICATIONS_ENDPOINT String https://api.n8n.io/versions/ The endpoint to retrieve where version information.
N8N_VERSION_NOTIFICATIONS_INFO_URL String https://docs.n8n.io/getting-started/installation/updating.html The URL displayed in the New Versions panel for more information.
N8N_DIAGNOSTICS_ENABLED Boolean true Whether to share selected, anonymous telemetry with n8n. Note that if you set this to false, you can't enable Ask AI in the Code node.
N8N_DIAGNOSTICS_CONFIG_FRONTEND String 1zPn9bgWPzlQc0p8Gj1uiK6DOTn;https://telemetry.n8n.io Telemetry configuration for the frontend.
N8N_DIAGNOSTICS_CONFIG_BACKEND String 1zPn7YoGC3ZXE9zLeTKLuQCB4F6;https://telemetry.n8n.io/v1/batch Telemetry configuration for the backend.
N8N_PUSH_BACKEND String websocket Choose whether the n8n backend uses server-sent events (sse) or WebSockets (websocket) to send changes to the UI.
VUE_APP_URL_BASE_API String http://localhost:5678/ Used when building the n8n-editor-ui package manually to set how the frontend can reach the backend API. Refer to Configure the Base URL.
N8N_HIRING_BANNER_ENABLED Boolean true Whether to show the n8n hiring banner in the console (true) or not (false).
N8N_PUBLIC_API_SWAGGERUI_DISABLED Boolean false Whether the Swagger UI (API playground) is disabled (true) or not (false).
N8N_PUBLIC_API_DISABLED Boolean false Whether to disable the public API (true) or not (false).
N8N_PUBLIC_API_ENDPOINT String api Path for the public API endpoints.
N8N_GRACEFUL_SHUTDOWN_TIMEOUT Number 30 How long should the n8n process wait (in seconds) for components to shut down before exiting the process.
N8N_DEV_RELOAD Boolean false When working on the n8n source code, set this to true to automatically reload or restart the application when changes occur in the source code files.
N8N_REINSTALL_MISSING_PACKAGES Boolean false If set to true, n8n will automatically attempt to reinstall any missing packages.
N8N_TUNNEL_SUBDOMAIN String - Specifies the subdomain for the n8n tunnel. If not set, n8n generates a random subdomain.
N8N_PROXY_HOPS Number 0 Number of reverse-proxies n8n is running behind.