Skip to content

Instantly share code, notes, and snippets.

@ErFUN-KH
Last active December 2, 2023 17:28
Show Gist options
  • Save ErFUN-KH/0e52696818c8c808900ac294b9010e62 to your computer and use it in GitHub Desktop.
Save ErFUN-KH/0e52696818c8c808900ac294b9010e62 to your computer and use it in GitHub Desktop.
V2ray-new
{
"log": {
"loglevel": "warning",
"access": "/var/log/xray/access.log",
"error": "/var/log/xray/error.log"
},
"inbounds": [{
"port": 10000,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "50b9be5c-18f8-f885-965a-36d5a334cee4",
"level": 1,
"alterId": 64
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/update-data"
}
}
}],
"outbounds": [{
"protocol": "freedom",
"settings": {}
},{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}],
"routing": {
"rules": [
{
"type": "field",
"ip": ["geoip:private"],
"outboundTag": "blocked"
}
]
}
}
@ErFUN-KH
Copy link
Author

add your domain to the CDN and add the IP address to the DNS but disable the CDN, it should connect to the server directly
Run these commands:

apt upgrade
apt install nginx python3-certbot-nginx
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install --version 1.8.1
systemctl enable xray
nano /usr/local/etc/xray/config.json
{
  "log": {
    "loglevel": "warning",
    "access": "/var/log/xray/access.log", 
    "error": "/var/log/xray/error.log"
  },
  "inbounds": [{
    "port": 10000,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "50b9be5c-18f8-f885-965a-36d5a334cee4",
          "level": 1,
          "alterId": 64
        }
      ]
    },
    "streamSettings": {
      "network": "ws",
      "wsSettings": {
        "path": "/update-data"
      }
    }
  }],
  "outbounds": [{
    "protocol": "freedom",
    "settings": {}
  },{
    "protocol": "blackhole",
    "settings": {},
    "tag": "blocked"
  }],
  "routing": {
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      }
    ]
  }
}

nano /etc/nginx/sites-enabled/your_domain_name.com

server {
    server_name your_domain_name.com;

    listen 80;
 
    location /update-data {
     proxy_redirect off;
     proxy_pass http://127.0.0.1:10000;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "upgrade";
     proxy_set_header Host $http_host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
sudo nginx -t
systemctl restart nginx.service
certbot --nginx

select your domain number and...

then turn the CDN on.

Done

@a899zzz7828zaaa
Copy link

[](url)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment