说明
使用的项目地址:https://github.com/XTLS/Xray-core
一键脚本:https://github.com/XTLS/Xray-install
各种类型的配置文件参考:https://github.com/XTLS/Xray-examples
开始
脚本安装
1
| bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
|
安装的目录情况
installed: /etc/systemd/system/xray.service
installed: /etc/systemd/system/xray@.service
installed: /usr/local/bin/xray
installed: /usr/local/etc/xray/*.json
installed: /usr/local/share/xray/geoip.dat
installed: /usr/local/share/xray/geosite.dat
installed: /var/log/xray/access.log
installed: /var/log/xray/error.log
修改配置文件
1
| vim /usr/local/etc/xray/config.json
|
文件内容如下,自行修改监听端口,uuid 还有路径
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
{ "log": { "loglevel": "warning", "access": "/var/log/xray/access.log", "error": "/var/log/xray/error.log" }, "dns": { "servers": ["8.8.8.8", "localhost"] }, "routing": { "domainStrategy": "AsIs", "rules": [ { "type": "field", "ip": [ "geoip:private" ], "outboundTag": "block" } ] }, "inbounds": [ { "listen": "0.0.0.0", "port": 33366, "protocol": "vmess", "settings": { "clients": [ { "id": "5f890a31-27b0-463e-a93f-6a46b9f963a1" } ] }, "streamSettings": { "network": "ws", "security": "none", "wsSettings": { "path": "/video" } } } ], "outbounds": [ { "protocol": "freedom", "tag": "direct" }, { "protocol": "blackhole", "tag": "block" } ] }
|
配置 Nginx 反向代理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| server { listen 80; listen [::]:80; server_name pull.free.video.10010.com;
location /video { proxy_pass http://127.0.0.1:33366; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; } location / { try_files $uri $uri/ =404; } }
|