本帖最後由 MirageKnight 於 2018-5-22 16:33 編輯
V2RAY 算是最易的一部份了.
我建議安裝official v2ray那個版本. 最新最update的.
首先在"/share/Container/volumes" 加一個 "v2ray" folder. v2ray folder內加一個"conf"
在 "conf" 用 text editor edit 一個config file. 如果你已經有V2RAY docker. 你可以由container copy 出來. 參考在nignx那部份.
修改它變成行websock. 我的config file 如下.- {
- "log" : {
- "access": "/var/log/v2ray/access.log",
- "error": "/var/log/v2ray/error.log",
- "loglevel": "warning"
- },
- "inbound": {
- "port": 46889,
- "protocol": "vmess",
- "settings": {
- "clients": [
- {
- "id": "27c05b31-fd5e-4dbf-xxxx-9ba9d14f80be", #請用自己的uuid. 我估你知係乜來. 唔知google 下
- "level": 1,
- "alterId": 64
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "auto",
- "wsSettings": {
- "connectionReuse": false,
- "path": "/letmefree/"
- }
- }
- },
- "outbound": {
- "protocol": "freedom",
- "settings": {}
- },
- "inboundDetour": [
- {
- "protocol": "shadowsocks",
- "port": 184774,
- "settings": {
- "method": "aes-256-cfb",
- "password": "your password for SS backup connection",
- "udp": true,
- "level": 1
- }
- },
- {
- "protocol": "shadowsocks",
- "port": 18471,
- "settings": {
- "method": "aes-256-cfb",
- "password": "your password for SS backup connection",
- "udp": true,
- "level": 1
- }
- }
- ],
- "outboundDetour": [{
- "protocol": "blackhole",
- "settings": {},
- "tag": "blocked"
- }],
-
- "routing": {
- "strategy": "rules",
- "settings": {
- "rules": [{
- "type": "field",
- "ip": [
- "0.0.0.0/8",
- "10.0.0.0/8",
- "100.64.0.0/10",
- "127.0.0.0/8",
- "169.254.0.0/16",
- "172.16.0.0/12",
- "192.0.0.0/24",
- "192.0.2.0/24",
- "192.168.0.0/16",
- "198.18.0.0/15",
- "198.51.100.0/24",
- "203.0.113.0/24",
- "::1/128",
- "fc00::/7",
- "fe80::/10"
- ],
- "outboundTag": "blocked"
- }]
- }
- }
- }
複製代碼 請自行修改config file. 以上只作參考. websock 主要是在"streamingSettings" 那一部份.
有了config file. 那便開始安裝.
在安裝時一樣是用Bridge mode. 也設是一個在host的folder 給它作config file mount point.
如圖.
如果config file沒有問題. V2RAY 便順利完成. 最最後一步. 修改NGINX config.
用text editor 修改"/share/Container/volumes/nginx/conf/nginx.conf".
以下config只作參考.- user nginx;
- worker_processes 1;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- sendfile on;
- keepalive_timeout 65;
-
- #這樣的設定會redirect 所有80 port 的http. 去 443 port 的https. 請放心. letsencrp 支援 https 的 challange的.
- server {
- listen 80;
- listen [::]:80;
- server_name yoursite.myqnapcloud.com;
- return 301 https://yoursite.myqnapcloud.com$request_uri;
- }
- server {
- listen 443 ssl http2;
- listen [::]:443;
- server_name yoursite.myqnapcloud.com;
- ssl on;
- ssl_certificate /etc/nginx/certs/signed_chain.crt;
- ssl_certificate_key /etc/nginx/certs/domain.key;
- ssl_session_timeout 10m;
-
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA;
- ssl_prefer_server_ciphers on;
-
- # proxy your web site, 修改當中的 "https://" 去你的web server https port. 如果你沒有host webserver. 可以改成" return 404;:
- location / {
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $host;
- proxy_pass https://your.nas.webpage.https.ip.address:8080/;
- }
- # letsencrypt web challenge page
- location ^~ /.well-known/acme-challenge/ {
- default_type "text/plain";
- root /usr/share/nginx/html/letsencrypt;
- }
- # for security
- location = /.well-known/acme-challenge/ {
- return 404;
- }
- # for V2RAY. 請跟足那幾句" proxy_" setting. 這樣nginx才會用websock pass data 去V2RAY. 自行修改"proxy_pass" 到 你的V2RAY docker ip 和 listen port.
- location /letmefree/ {
- proxy_redirect off;
- proxy_http_version 1.1;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_set_header Host $http_host;
- proxy_pass http://v2raydockerip:46889;
- }
-
- }
- }
複製代碼 修改完成後. restart NGINX 這個container. 如果沒有問題便完工.
你可以用不同的 V2RAY client來試了.
記得要enable "MUX".
address入返你個DDNS或ip.
v2ray 的PORT 是443.
用返和server一樣的UID 和alterid.
security 用 "aes-128-cfb"
network 選 "ws/websock"
path 入返你在nginx和v2ray 一樣的patch . 上面用 "/letmefree/"
tls 請選 "tls".
咁樣就完成. |