EasyXrayEasyXray

Environment Variables

Complete reference for EasyXray's EASYXRAY_* environment variables — database, panel, logging, memory, node token encryption, and the tunnel health monitor.

EasyXray reads its runtime configuration from EASYXRAY_* environment variables. On a script install the installer writes them to the service environment file (/etc/default/easyxray, or /etc/conf.d/easyxray / /etc/sysconfig/easyxray depending on the distro); for Docker you set them in docker-compose.yml or docker run -e. Defaults are sensible — set only what you need to change, then restart: systemctl restart easyxray.

Database

VariableDefaultDescription
EASYXRAY_DB_TYPEsqliteBackend: sqlite, or postgres (also accepts postgresql / pg).
EASYXRAY_DB_FOLDER/etc/easyxrayFolder for the SQLite database file (EasyXray.db).
EASYXRAY_DB_DSN—PostgreSQL connection string (used when EASYXRAY_DB_TYPE=postgres).
EASYXRAY_DB_MAX_OPEN_CONNS—Max open connections in the PostgreSQL pool.
EASYXRAY_DB_MAX_IDLE_CONNS—Max idle connections in the PostgreSQL pool.

The default SQLite database path is /etc/easyxray/EasyXray.db. See Database for the SQLite ↔ PostgreSQL details.

Panel

VariableDefaultDescription
EASYXRAY_PORT—Override the panel port (1–65535). Takes precedence over the stored setting.
EASYXRAY_INIT_WEB_BASE_PATH/Initial web base path on first launch (e.g. /mypanel).
EASYXRAY_ENABLE_FAIL2BANtrueEnable Fail2ban-based IP-limit enforcement.
EASYXRAY_SKIP_HSTSfalseSkip the HSTS header — set true when TLS is terminated by a reverse proxy.

Node token encryption

Node API bearer tokens — and the stored PIA token — are kept in plaintext by default. Encryption at rest is opt-in and fails closed: with any mode other than off, the panel refuses to start unless it can load a key.

VariableDefaultDescription
NODE_TOKEN_ENCRYPTIONoffoff, migration (reads accept plaintext or ciphertext, writes encrypt), or required (same writes, startup fails without a key). Note the missing EASYXRAY_ prefix.
EASYXRAY_NODE_TOKEN_KEY_FILE/etc/easyxray/node_token_key.jsonJSON keyring, mode 0600 or stricter (not checked on Windows, where NTFS permissions protect it). Loaded first.
EASYXRAY_NODE_TOKEN_KEY—A single base64 32-byte key, read only when the key file fails to load. Its key id is fixed to env, so it cannot rotate.

The key file names the active key plus every older key still needed to decrypt:

{ "active": "k1", "keys": { "k1": "<base64 32-byte key>" } }

Generate a key with openssl rand -base64 32; keys are never accepted as command-line arguments. After enabling a mode, re-encrypt the rows already in the database under the active key:

easyxray encrypt-tokens

That covers node rows; the PIA token is re-encrypted the next time it is read. To rotate, add the new key to keys, point active at it, keep the old key for decryption, and run easyxray encrypt-tokens again.

Logging & binaries

VariableDefaultDescription
EASYXRAY_LOG_LEVELinfodebug, info, notice, warning, or error.
EASYXRAY_DEBUGfalseDebug mode (forces log level to debug).
EASYXRAY_LOG_FOLDER/var/log/easyxrayLog output directory.
EASYXRAY_BIN_FOLDERbinFolder for the Xray-core binary and geosite/geoip files.

Memory & profiling

The panel keeps memory low via GOGC and periodic releases. These are advanced knobs — leave them unset unless you're tuning a constrained host.

VariableDefaultDescription
EASYXRAY_GOGC—Go GC target percentage; lower = less RAM, slightly more CPU.
EASYXRAY_MEMORY_RELEASE_INTERVAL—Minutes between FreeOSMemory calls; 0 disables.
EASYXRAY_MEMORY_LIMIT—Go soft memory limit in MiB.
GOMEMLIMIT—Go-syntax soft limit (e.g. 400MiB); takes precedence over above.
EASYXRAY_PPROFfalseExpose pprof profiling on 127.0.0.1:6060.

Xray

VariableDefaultDescription
XRAY_VMESS_AEAD_FORCEDfalseForce VMess AEAD.

Tunnel health monitor

Optional watchdog: it probes a URL (optionally through a local Xray inbound) and restarts Xray after repeated failures. A restart drops all connected clients, so enable it deliberately.

VariableDefaultDescription
EASYXRAY_TUNNEL_HEALTH_MONITORfalseEnable the monitor.
EASYXRAY_TUNNEL_HEALTH_PROXY—Proxy to send the probe through, e.g. socks5://127.0.0.1:1080. Empty = only checks host connectivity.
EASYXRAY_TUNNEL_HEALTH_URLhttps://www.cloudflare.com/cdn-cgi/traceURL to probe.
EASYXRAY_TUNNEL_HEALTH_INTERVAL30sInterval between probes.
EASYXRAY_TUNNEL_HEALTH_TIMEOUT10sPer-probe timeout.
EASYXRAY_TUNNEL_HEALTH_FAILURES3Consecutive failures before a restart.
EASYXRAY_TUNNEL_HEALTH_COOLDOWN5mMinimum delay between restarts.

Unattended install

VariableDescription
EASYXRAY_NONINTERACTIVESet to 1 (or run with no TTY) to install with zero prompts; generated credentials are written to /etc/easyxray/install-result.env. See Installation.

On this page