Environment Variables and Command Line arameters
Introduce
environment variables
Something might be old here, run v2raya --help
to get more informations about environment variables and parameters.
V2RAYA_ADDRESS
: The Listening Address of v2rayA. (“0.0.0.0:2017” for default)
V2RAYA_CONFIG
: The Configuration file Directory of v2rayA. ("/etc/v2raya" for default)
V2RAYA_V2RAY_BIN
: v2ray executable file path. Leave blank to auto-detect. It can be modified to the file path of v2ray branches such as xray.
V2RAYA_V2RAY_ASSETSDIR
: The path of the data file used by v2ray.
V2RAYA_V2RAY_CONFDIR
: Additional v2ray configuration file directory, the v2ray configuration file in this directory will be combined with the configuration file generated by v2rayA.
V2RAYA_WEBDIR
: v2rayA front-end GUI file directory, if not specified, the binary embedded GUI file will be used.
V2RAYA_PLUGINLISTENPORT
: Internal plug-in port of v2rayA. (32346 for default)
V2RAYA_FORCE_IPV6_ON
: Skip the check, force enable IPv6 support.
V2RAYA_PASSCHECKROOT
: Skip the root authority check, use it when you confirm that you have root authority but v2rayA makes a mistake, or use it when using a non-root user.
V2RAYA_VERBOSE
: Verbose log mode, mixedly print the running logs of v2ray-core and v2rayA. Will be deprecated in a future release.
V2RAYA_RESET_PASSWORD
: Reset password.
Command line parameters
Corresponding to the environment variable, use the following command to view the details:
v2raya --help
How to set
The following will take specifying V2RAYA_V2RAY_BIN
as xray as an example to introduce the setting methods in each environment.
v2rayA managed by systemd
This is generally the way to install using a package manager such as apt, or directly using the installation package.
Create a new folder
/etc/systemd/system/v2raya.service.d
, then create a newxray.conf
file, add the following content:[Service] Environment="V2RAYA_V2RAY_BIN=/usr/local/bin/xray"
Pay attention to check whether the path of Xray is correct.
Reload service:
sudo systemctl daemon-reload && sudo systemctl restart v2raya
OpenWrt
For adapted options:
See
/etc/config/v2raya
for a detailed configurable listuci set v2raya.config.enabled='1' uci commit v2raya
For unadapted options (nightly / advanced users):
change
/etc/init.d/v2raya
start_service() { config_load "$CONF" is_enabled "config" "enabled" || exit 1 procd_open_instance "$CONF" procd_set_param command "$PROG" procd_set_param env XDG_DATA_HOME="/usr/share" # Add commands procd_append_param command --v2ray-bin="/usr/bin/xray" # Add envs procd_append_param env V2RAYA_V2RAY_BIN="/usr/bin/xray" --- cut here ---
Overload service:
/etc/init.d/v2raya restart
Alpine
Modify command_args
in /etc/init.d/v2raya
, for example:
#!/sbin/openrc-run
name="v2rayA"
description="A Linux web GUI client of Project V which supports V2Ray, Xray, SS, SSR, Trojan and Pingtunnel"
command="/usr/local/bin/v2raya"
command_args="--config=/usr/local/etc/v2raya --v2ray-bin=/usr/local/bin/xray"
pidfile="/run/${RC_SVCNAME}.pid"
command_background="yes"
depend() {
need net
}
Then restart the service.
Docker
Use -e
to specify the environment variable. The following example modifies the listening port to 2021:
# run v2raya
docker run -d \
--restart=always \
--privileged \
--network=host \
--name v2raya \
-e V2RAYA_ADDRESS=0.0.0.0:2021 \
-v /lib/modules:/lib/modules \
-v /etc/resolv.conf:/etc/resolv.conf \
-v /etc/v2raya:/etc/v2raya \
mzz2017/v2raya
Last update on: Dec 23, 2022 14:24 +0800