分类
Linux

V2ray + VMess + WebSocket + TLS + Apache 配置

这个是V2ray社区推荐的最理想方案。

1. 使用 LAMP 一键脚本

安装和配置 Apache 环境:https://lamp.sh/

运行 lamp add 时选择 Let's Encrypt 证书,后续需要使用

2. 修改 httpd 配置

修改/usr/local/apache/conf/httpd.conf,开启

LoadModule proxy_wstunnel_module libexec/apache2/mod_proxy_wstunnel.so

3. 安装 V2ray

服务器配置如下:

{
     "inbounds": [{
         "port": 10010,
         "listen": "127.0.0.1",
         "protocol": "vmess",
         "settings": {
             "clients": [{
                 "id": "Type your UUID here",
                 "alterId": 0
             }]
         },
         "streamSettings": {
             "network": "ws",
             "wsSettings": {
                 "path": "/typesomething/"
             }
         }
     }],
     "outbounds": [{
         "protocol": "freedom",
         "settings": {}
     }]
 }

4. Apache 配置

修改 /usr/local/apache/conf/vhost/ 里面你运行 lamp add 新增的 vhost,在 里面添加:

<VirtualHost *:443>
       <LocationMatch "/ray/">
        ProxyPass ws://127.0.0.1:10010/typesomething/ upgrade=WebSocket
        ProxyAddHeaders Off
        ProxyPreserveHost On
        RequestHeader set Host %{HTTP_HOST}s
        RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
       </LocationMatch>
</VirtualHost>

5. V2ray客户端配置:

{
     "inbounds": [{
         "port": 1090,
         "listen": "127.0.0.1",
         "protocol": "socks",
         "sniffing": {
             "enabled": true,
             "destOverride": ["http", "tls"]
         },
         "settings": {
             "auth": "noauth",
             "udp": false
         }
     }],
     "outbounds": [{
         "protocol": "vmess",
         "settings": {
             "vnext": [{
                 "address": "Your Domain",
                 "port": 443,
                 "users": [{
                     "id": "Type your UUID here",
                     "alterId": 0
                 }]
             }]
         },
         "streamSettings": {
             "network": "ws",
             "security": "tls",
             "wsSettings": {
                 "path": "/typesomething/"
             }
         }
     }]
 }

6. 隐藏真实 IP

如果你想隐藏真实 IP,可以开启使用 Cloudflare 的免费 CDN。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

*

code