Files
3x-ui/docs/content/docs/fa/reference/env-vars.mdx
MHSanaei 9b91f0f42e docs: vendor the documentation site into the monorepo
Fold the standalone 3x-ui-docs project (Next.js 16 + Fumadocs, deployed to
docs.sanaei.dev) into docs/ so the panel and its documentation share a single
source of truth, the way sing-box keeps its docs in-tree. The old repo becomes
redundant and can be retired.

- Import the full site under docs/ (app, components, content, lib, public,
  scripts, config). The self-contained pnpm project sits alongside the existing
  engineering notes with no filename collisions.
- Re-point "Edit on GitHub" links from MHSanaei/3x-ui-docs to this repo's
  docs/content/docs path (docs/lib/shared.ts, docs/app/.../page.tsx).
- Add docs-ci.yml and docs-deploy.yml under .github/workflows/, scoped to
  docs/** and run with working-directory: docs, since GitHub only runs
  workflows from the repo-root .github/. deploy-static.yml's GitHub Pages
  publish (CNAME docs.sanaei.dev) carries over unchanged.

Follow-up (outside this commit): attach the docs.sanaei.dev custom domain to
this repository's Pages (or set the Vercel project's root directory to docs),
confirm the site is live from the monorepo, then delete MHSanaei/3x-ui-docs.
2026-07-07 23:07:14 +02:00

86 lines
7.8 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.
---
title: متغیرهای محیطی
description: مرجع کامل متغیرهای محیطی `XUI_*` در 3x-ui — پایگاه‌داده، پنل، لاگ‌گیری، حافظه و پایشگر سلامت تونل.
icon: Variable
---
3x-ui پیکربندی زمان‌اجرای خود را از متغیرهای محیطی `XUI_*` می‌خواند. در نصب
اسکریپتی، نصب‌کننده آن‌ها را در فایل محیطی سرویس می‌نویسد
(`/etc/default/x-ui`، یا بسته به توزیع `/etc/conf.d/x-ui` / `/etc/sysconfig/x-ui`)؛
برای Docker آن‌ها را در `docker-compose.yml` یا `docker run -e` تنظیم می‌کنید.
مقادیر پیش‌فرض منطقی هستند — فقط آنچه را که نیاز به تغییر دارید تنظیم کنید، سپس
ری‌استارت کنید: `systemctl restart x-ui`.
## پایگاه‌داده
| Variable | Default | Description |
| ------------------------ | ----------- | -------------------------------------------------------------------- |
| `XUI_DB_TYPE` | `sqlite` | بک‌اند: `sqlite`، یا `postgres` (همچنین `postgresql` / `pg` را می‌پذیرد). |
| `XUI_DB_FOLDER` | `/etc/x-ui` | پوشه‌ی فایل پایگاه‌داده‌ی SQLite (`x-ui.db`). |
| `XUI_DB_DSN` | — | رشته‌ی اتصال PostgreSQL (وقتی `XUI_DB_TYPE=postgres` باشد استفاده می‌شود). |
| `XUI_DB_MAX_OPEN_CONNS` | — | حداکثر اتصالات باز در استخر PostgreSQL. |
| `XUI_DB_MAX_IDLE_CONNS` | — | حداکثر اتصالات بی‌کار در استخر PostgreSQL. |
مسیر پیش‌فرض پایگاه‌داده‌ی SQLite برابر `/etc/x-ui/x-ui.db` است. برای جزئیات
SQLite ↔ PostgreSQL به [پایگاه‌داده](/docs/reference/database) مراجعه کنید.
## پنل
| Variable | Default | Description |
| ------------------------ | ------- | ------------------------------------------------------------------------ |
| `XUI_PORT` | — | بازنویسی پورت پنل (۱ تا ۶۵۵۳۵). بر تنظیم ذخیره‌شده اولویت دارد. |
| `XUI_INIT_WEB_BASE_PATH` | `/` | مسیر پایه‌ی وب اولیه در **نخستین** اجرا (مثلاً `/panel`). |
| `XUI_ENABLE_FAIL2BAN` | `true` | فعال‌سازی اعمالِ محدودیت IP مبتنی بر Fail2ban. |
| `XUI_SKIP_HSTS` | `false` | رد کردن هدر HSTS — وقتی TLS توسط یک پروکسی معکوس خاتمه می‌یابد، `true` تنظیم کنید. |
## لاگ‌گیری و باینری‌ها
| Variable | Default | Description |
| ---------------- | ---------------- | ----------------------------------------------------------- |
| `XUI_LOG_LEVEL` | `info` | `debug`، `info`، `notice`، `warning`، یا `error`. |
| `XUI_DEBUG` | `false` | حالت دیباگ (سطح لاگ را به `debug` وادار می‌کند). |
| `XUI_LOG_FOLDER` | `/var/log/x-ui` | پوشه‌ی خروجی لاگ. |
| `XUI_BIN_FOLDER` | `bin` | پوشه‌ی باینری Xray-core و فایل‌های geosite/geoip. |
## حافظه و پروفایلینگ
پنل با استفاده از `GOGC` و آزادسازی‌های دوره‌ای، مصرف حافظه را پایین نگه می‌دارد.
این‌ها تنظیمات پیشرفته‌ای هستند — مگر اینکه در حال تنظیم دقیق یک میزبان با منابع
محدود باشید، آن‌ها را تنظیم‌نشده رها کنید.
| Variable | Default | Description |
| ----------------------------- | ------- | ----------------------------------------------------------------- |
| `XUI_GOGC` | — | درصد هدف GC در Go؛ کمتر = RAM کمتر، CPU اندکی بیشتر. |
| `XUI_MEMORY_RELEASE_INTERVAL` | — | فاصله‌ی زمانی فراخوانی‌های `FreeOSMemory` بر حسب دقیقه؛ مقدار `0` آن را غیرفعال می‌کند. |
| `XUI_MEMORY_LIMIT` | — | محدودیت نرم حافظه‌ی Go بر حسب **MiB**. |
| `GOMEMLIMIT` | — | محدودیت نرم با نحو Go (مثلاً `400MiB`)؛ بر مورد بالا اولویت دارد.|
| `XUI_PPROF` | `false` | در دسترس قرار دادن پروفایلینگ pprof روی `127.0.0.1:6060`. |
## Xray
| Variable | Default | Description |
| ------------------------ | ------- | --------------------- |
| `XRAY_VMESS_AEAD_FORCED` | `false` | الزامی‌کردن VMess AEAD. |
## پایشگر سلامت تونل
نگهبان اختیاری: یک URL را پروب می‌کند (به‌صورت اختیاری **از طریق** یک ورودی محلی
Xray) و پس از خرابی‌های مکرر، Xray را ری‌استارت می‌کند. هر ری‌استارت همه‌ی
کلاینت‌های متصل را قطع می‌کند، پس آن را آگاهانه فعال کنید.
| Variable | Default | Description |
| ----------------------------- | -------------------------------------------- | ----------------------------------------------------------------- |
| `XUI_TUNNEL_HEALTH_MONITOR` | `false` | فعال‌سازی پایشگر. |
| `XUI_TUNNEL_HEALTH_PROXY` | — | پروکسی‌ای که پروب از طریق آن ارسال می‌شود، مثلاً `socks5://127.0.0.1:1080`. خالی = فقط اتصال میزبان را بررسی می‌کند. |
| `XUI_TUNNEL_HEALTH_URL` | `https://www.cloudflare.com/cdn-cgi/trace` | URLی که پروب می‌شود. |
| `XUI_TUNNEL_HEALTH_INTERVAL` | `30s` | فاصله‌ی زمانی بین پروب‌ها. |
| `XUI_TUNNEL_HEALTH_TIMEOUT` | `10s` | مهلت زمانی هر پروب. |
| `XUI_TUNNEL_HEALTH_FAILURES` | `3` | تعداد خرابی‌های متوالی پیش از یک ری‌استارت. |
| `XUI_TUNNEL_HEALTH_COOLDOWN` | `5m` | حداقل تأخیر بین ری‌استارت‌ها. |
## نصب بدون نظارت
| Variable | Description |
| -------------------- | -------------------------------------------------------------------------------------------- |
| `XUI_NONINTERACTIVE` | روی `1` تنظیم کنید (یا بدون TTY اجرا کنید) تا نصب بدون هیچ پرسشی انجام شود؛ اطلاعات احراز هویتِ تولیدشده در `/etc/x-ui/install-result.env` نوشته می‌شوند. نگاه کنید به [نصب](/docs/guide/installation#unattended--cloud-init). |