1
0

.env.example 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. # This file serves a dual purpose:
  2. # 1. Developer Bootstrap: The active (uncommented) variables directly below
  3. # configure a safe, unprivileged local environment for 'go run .'.
  4. # This allows 'cp .env.example .env' to work out-of-the-box without root.
  5. # 2. Production Reference: All available XUI_* configuration options are
  6. # documented and commented out in the reference section further below.
  7. #
  8. # 3x-ui reads its runtime configuration from XUI_* environment variables.
  9. # On a script install, the installer writes them to the service environment file
  10. # (/etc/default/x-ui, /etc/conf.d/x-ui, or /etc/sysconfig/x-ui depending on the distro).
  11. # For Docker, you set them in docker-compose.yml or via 'docker run -e'.
  12. #
  13. # Defaults are sensible — set only what you need to change, then restart:
  14. # systemctl restart x-ui
  15. # ------------------------------------------------------------------------------
  16. # LOCAL DEVELOPMENT OVERRIDES (ACTIVE BY DEFAULT)
  17. # ------------------------------------------------------------------------------
  18. XUI_DEBUG=true
  19. XUI_DB_FOLDER=x-ui
  20. XUI_LOG_FOLDER=x-ui
  21. XUI_BIN_FOLDER=x-ui
  22. XUI_INIT_WEB_BASE_PATH=/
  23. # ==============================================================================
  24. # REFERENCE CONFIGURATION (ALL OPTIONS)
  25. # ==============================================================================
  26. # ------------------------------------------------------------------------------
  27. # Database
  28. # ------------------------------------------------------------------------------
  29. # Backend database type: sqlite, or postgres (also accepts postgresql / pg)
  30. # Default: sqlite
  31. #XUI_DB_TYPE=sqlite
  32. # Folder for the SQLite database file (x-ui.db)
  33. # Default: /etc/x-ui (Overridden to 'x-ui' in the development block above)
  34. #XUI_DB_FOLDER=/etc/x-ui
  35. # PostgreSQL connection string (used when XUI_DB_TYPE=postgres)
  36. # Example: postgres://user:password@localhost:5432/dbname?sslmode=disable
  37. #XUI_DB_DSN=
  38. # Max open connections in the PostgreSQL pool
  39. #XUI_DB_MAX_OPEN_CONNS=
  40. # Max idle connections in the PostgreSQL pool
  41. #XUI_DB_MAX_IDLE_CONNS=
  42. # PostgreSQL Docker Container Settings
  43. # Default credentials used if you are running PostgreSQL via docker-compose
  44. #POSTGRES_USER=xui
  45. #POSTGRES_PASSWORD=xui
  46. #POSTGRES_DB=xui
  47. # ------------------------------------------------------------------------------
  48. # Panel
  49. # ------------------------------------------------------------------------------
  50. # Override the panel port (1–65535). Takes precedence over the stored setting.
  51. #XUI_PORT=
  52. # Initial web base path on FIRST launch (e.g., /panel)
  53. # Default: /
  54. #XUI_INIT_WEB_BASE_PATH=/
  55. # Enable Fail2ban-based IP-limit enforcement
  56. # Default: true
  57. #XUI_ENABLE_FAIL2BAN=true
  58. # Skip the HSTS header — set true when TLS is terminated by a reverse proxy
  59. # Default: false
  60. #XUI_SKIP_HSTS=false
  61. # ------------------------------------------------------------------------------
  62. # Logging & binaries
  63. # ------------------------------------------------------------------------------
  64. # Logging level: debug, info, notice, warning, or error
  65. # Default: info
  66. #XUI_LOG_LEVEL=info
  67. # Debug mode. Forces log level to debug, enables Gin debug mode,
  68. # and ensures frontend assets are served directly from disk (see CLAUDE.md).
  69. # Default: false (Overridden to 'true' in the development block at the top)
  70. #XUI_DEBUG=false
  71. # Log output directory
  72. # Default: /var/log/x-ui (Overridden to 'x-ui' in the development block above)
  73. #XUI_LOG_FOLDER=/var/log/x-ui
  74. # Folder for the Xray-core binary and geosite/geoip files
  75. # Default: bin (Overridden to 'x-ui' in the development block above)
  76. #XUI_BIN_FOLDER=bin
  77. # Legacy Path Settings
  78. # Main installation folder (Default: /usr/local/x-ui for Linux, /app for Docker)
  79. #XUI_MAIN_FOLDER=/usr/local/x-ui
  80. # Path to the systemd service file (Default: /etc/systemd/system)
  81. #XUI_SERVICE=/etc/systemd/system
  82. # ------------------------------------------------------------------------------
  83. # Memory & profiling
  84. # ------------------------------------------------------------------------------
  85. # Go GC target percentage; lower = less RAM, slightly more CPU.
  86. # Default: 75
  87. #XUI_GOGC=
  88. # Minutes between FreeOSMemory calls; 0 disables.
  89. # Default: 10
  90. #XUI_MEMORY_RELEASE_INTERVAL=
  91. # Go soft memory limit in MiB
  92. #XUI_MEMORY_LIMIT=
  93. # Go-syntax soft limit (e.g., 400MiB); takes precedence over XUI_MEMORY_LIMIT
  94. #GOMEMLIMIT=
  95. # Expose pprof profiling on 127.0.0.1:6060
  96. # Default: false
  97. #XUI_PPROF=false
  98. # Automatically set to 'true' inside the official Docker image.
  99. # Consumed by internal scripts (x-ui.sh) to detect the environment.
  100. # There is normally no need to set or toggle this variable manually.
  101. # Default: false (automatically 'true' in Docker environments)
  102. #XUI_IN_DOCKER=false
  103. # ------------------------------------------------------------------------------
  104. # Xray
  105. # ------------------------------------------------------------------------------
  106. # Force VMess AEAD
  107. # Default: false
  108. #XRAY_VMESS_AEAD_FORCED=false
  109. # ------------------------------------------------------------------------------
  110. # Tunnel health monitor
  111. # ------------------------------------------------------------------------------
  112. # Optional watchdog: probes a URL (optionally through a local Xray inbound)
  113. # and restarts Xray after repeated failures. A restart drops all connected clients.
  114. # Default: false
  115. #XUI_TUNNEL_HEALTH_MONITOR=false
  116. # Proxy to send the probe through, e.g., socks5://127.0.0.1:1080
  117. # Empty = only checks host connectivity
  118. #XUI_TUNNEL_HEALTH_PROXY=
  119. # URL to probe
  120. # Default: https://www.cloudflare.com/cdn-cgi/trace
  121. #XUI_TUNNEL_HEALTH_URL=https://www.cloudflare.com/cdn-cgi/trace
  122. # Interval between probes
  123. # Default: 30s
  124. #XUI_TUNNEL_HEALTH_INTERVAL=30s
  125. # Per-probe timeout
  126. # Default: 10s
  127. #XUI_TUNNEL_HEALTH_TIMEOUT=10s
  128. # Consecutive failures before a restart
  129. # Default: 3
  130. #XUI_TUNNEL_HEALTH_FAILURES=3
  131. # Minimum delay between restarts
  132. # Default: 5m
  133. #XUI_TUNNEL_HEALTH_COOLDOWN=5m
  134. # ------------------------------------------------------------------------------
  135. # Unattended install
  136. # ------------------------------------------------------------------------------
  137. # Set to 1 (or run with no TTY) to install with zero prompts.
  138. # Generated credentials will be written to /etc/x-ui/install-result.env
  139. #XUI_NONINTERACTIVE=1