set up v2ray with ws+tls

The idea  is your computer running v2ray client sends traffic to an https website address like https://domainhostseotool.com/ray. This website returns normal website content except for location /ray. For this special location, the httpd server Apache behaviors as a reverse proxy and transfers the traffic it receives to v2ray server running on the same machine. The v2ray server routes the traffic to external websites and transfers back the response it receives from external websites to apache server which transfers the data back to the v2ray client.

install and config v2ray server

use the following command to install v2ray:

edit the v2ray config file /usr/local/etc/v2ray/config.json(not /etc/v2ray/config.json which was used by old version of v2ray)

The uuid for settings/clients/id can be generated with the following command:

restart and enable v2ray:

Now, you should see v2ray is listening on port 12345. You should configure your firewall to unblock this port.

 

set up apache as reverse proxy

Assume you’ve already set up an https website domainhostseotool.com, the left work is just adding several lines(the <Location> part) to the virtual host for the domain:

Note that the location must keep consistent with the path in /usr/local/etc/v2ray/config.json.

restart httpd

set up v2ray client

We use QV2ray as an example to demonstrate how to config v2ray client.

You can download qv2ray prebuilt or download source code to build yourself. However, after install qv2ray, it cannot be used immediately. You have to download v2ray-core 4.45.2, unzip to a folder, and copy everything in this folder to config/vcore sub-directory under the qv2ray installation directory. Note that don’t download latest version of v2ray-core which won’t work with qv2ray. You can check if v2ray-core works by clicking the “Check V2ray Core Settings” button on the Preferences window of qv2ray.

qv2ray1

You almost don’t need to change anything on the Preference window for qv2ray to work. What you need to do is to click the new button on the home UI of qv2ray to create a link.

qv2ray2

qv2ray3

pay attention to keep the Path parameter consistent with that in httpd.conf and config.json for v2ray on remote server, otherwisem qv2ray will fail to connect and produce the following error:

app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://domainhostseotool.com/ray/): 404 Not Found > websocket: bad handshake] > common/retry: all retry attempts failed

Don’t use AlterID(let it be zero), otherwise you will see the following warning:

vmess md5 with non-zero alterid has been deprecated please use vmessaead

and the connection would fail with the following errors:

app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: connection ends > proxy/vmess/outbound: failed to read header > proxy/vmess/encoding: failed to read response header > websocket: close 1000 (normal)
app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: connection ends > proxy/vmess/outbound: failed to read header > proxy/vmess/encoding: failed to read response header > websocket: close 1000 (normal)
app/proxyman/outbound: failed to process outbound traffic > proxy/vmess/outbound: failed to find an available destination > common/retry: [transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://domainhostseotool.com/ray):  > malformed HTTP status code "set," transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://domainhostseotool.com/ray):  > malformed HTTP response "\xxx\xxx\xxx\xxx" transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://domainhostseotool.com/ray):  > malformed HTTP status code "set," transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://domainhostseotool.com/ray):  > malformed HTTP response "\xxx\xxx\xxx\xxx" transport/internet/websocket: failed to dial WebSocket > transport/internet/websocket: failed to dial to (wss://domainhostseotool.com/ray):  > malformed HTTP status code "set,"] > common/retry: all retry attempts failed

Be careful in filling the UUID. Missing a character would void the link and the buttons to start/edit the link would be disabled(greyed out).

 

The above is all that need to configure the QV2ray client. After creating the link, click the start button to connect to server and see whether you can visit websites normally in browser.

 

 

Posted in tips of hosting