V2ray Proxy Tool Configuration
V2ray is a network proxy tool. One possible configuration is to use WebSocket transport along with TLS, so network traffic looks like good normal HTTPS/WSS traffic in public network, very nice and effective against China’s firewall. This can be used along with web servers such as Apache or Nginx for reverse proxy. The entire network route looks like
1 | browser <=> v2ray client <=> webserver <=> v2ray server |
First, download v2ray binaries for both client and server.
V2ray Client Configuration
1 | { |
Sometimes MUX will cause entire connection to hang if one of them is broken, so I turn off this function.
V2ray Server Configuration
1 | { |
Apache Configuration
Webserver needs to have valid TLS certificate, such as getting one from Let’s Encrypt by certbot, to encrypt traffic in public network. The webserver decrypts TLS traffic and “proxypass” the WebSocket content to backend localhost:port number v2ray server.
1 | <LocationMatch "<path>"> |
Security
To improve security, run v2ray as regular user instead of root, so that possible security vulnerbility in v2ray does not compromise the entire system. Create a Linux user using useradd and configure systemd service to run v2ray with that user and group. Set the port number to be large enough that does not require superuser permission.
Further Steps
V2ray has new features such as QUIC and HTTP/2 transport. Maybe I will try them later.