Where Does Xray Store Its Config?
Xray reads JSON configs from a confdir on Linux (/etc/xray or /usr/local/etc/xray). Windows and macOS default to config.json beside the binary.
Last updated
Xray locates config by platform convention. Linux installs use /etc/xray/config.json or /usr/local/etc/xray/config.json depending on the script or package, launched with xray run -c pointing there. The official Docker image instead merges a confdir: every JSON file in /usr/local/etc/xray/ loads in sorted order. Windows and macOS builds look for config.json next to the executable.
The file holds inbounds, outbounds, routing, DNS, and transport security including REALITY keys and client UUIDs. That makes it both the backup and the secret store. Logs default under /var/log/xray in the Docker layout. Test every edit before restart; a bad JSON bracket kills the tunnel at 3 AM.
Where Xray stores this, by platform
/etc/xray/config.json
Inbounds, outbounds, routing, REALITY keys, UUIDs. Exact parent (/etc vs /usr/local/etc) follows your installer; check the systemd unit. Docker merges a confdir of numbered JSON files at the same concept path.
config.json (Xray directory)
Same JSON schema beside xray.exe. Panels and one-click scripts manage this file for you, but hand edits work identically. Keep a tested copy before changing transports.
Frequently asked questions
how do i migrate xray to a new server
Copy the config dir (or single config.json) plus any key files to the same path and run xray test (or -test -config=). The tester parses without binding ports. UUIDs and REALITY keys travel in the file, so treat the copy as secrets.
can xray split config across files
Yes. The official image runs xray -confdir /usr/local/etc/xray/ and merges every JSON file there in sorted order (00_log, 05_inbounds, 06_outbounds, and so on). Drop files in a mounted volume at that path; one file per concern keeps diffs readable.
Notice an outdated path? Let us know.