思绪的空中生活

宝塔面板 V2ray Websocket Nginx Cloudflare
前言:v2ray通过cloudflare拯救被封的IP,之前一直用的233blog的一键脚本,奈何nfp的ovz换...
扫描右侧二维码阅读全文
25
2019/01

宝塔面板 V2ray Websocket Nginx Cloudflare

前言:
v2ray通过cloudflare拯救被封的IP,之前一直用的233blog的一键脚本,奈何nfp的ovz换了4次系统都没能成功实现,所以手动搭建了,顺便开个记录贴

域名解析

1.使用cloudflare解析域名,为了方便测试,可以先把云朵点灰、关闭cdn(非必要,如果点灰了最后记得再次点亮云朵图标开启cdn)

安装宝塔面板

1.根据自己的系统使用正确的命令安装:

Centos安装命令
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install.sh && sh install.sh

Debian安装命令
wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && bash install.sh

2.安装完成后,登录BT面板,安装nginx
3.添加站点
输入自己的网址,ftp、数据库、php都不用
4.申请ssl
点击「设置」——SSL——Let’s Encrypt,成功申请SSL后,保存
5.更改 配置文件
再次点击站点「设置」的「配置文件」选项,在最后一个}前添加如下代码:

    location / {
    proxy_redirect off;
    proxy_pass http://127.0.0.1:25534;#25534是v2ray的端口号,注意和之后安装的一致
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
    }

6.重启Nignx

安装v2ray

1.安装命令
bash <(curl -L -s https://install.direct/go.sh)
2.修改v2ray配置文件,路径/etc/v2ray/config.json,修改后记得重启v2ray
参考配置:

{
    "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
    },
    "inbound": {
        "port": 25534,#自己的端口号需要对应
        "protocol": "vmess",
        "settings": {
            "udp": true,
            "clients": [
                {
                    "id": "e5cee2d4-d28b-4b8a-83ef-cf788bf1****",#自己的id
                    "level": 1,
                    "alterId": 233
                }
            ]
        },
        "streamSettings": {
            "network": "ws"
        }
    },
    "outbound": {
        "protocol": "freedom",
        "settings": {}
    },
    "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"
                }
            ]
        }
    }
}

3.V2Ray可使用的命令:

sudo service v2ray start #启动V2Ray
sudo service v2ray stop #停止运行V2Ray
sudo service v2ray restart #重启V2Ray
sudo service v2ray status #查看V2Ray状态

相关文章:

  • 中兴f460开启telnet
  • 宝塔面板安装frp
  • Qv2ray使用教程
  • N1将armbian刷入emmc
  • v2board前端 v2ray-poseidon后端 搭建
  • Last modification:January 25th, 2019 at 11:47 pm
    If you think my article is useful to you, please feel free to appreciate

    10 comments

    1. bhklin

      不知道回复到你没有
      只贴英文没有提示不能发表,
      NGINX换了几个版本也不行,网上搜到的教程跟现在宝塔的面板有点不一样,不知道是不是用的手机登录的原因,
      配置里面随便输入几个字母也是保存不了,不知道是不是要正确的语法

    2. emperinter
      该评论仅登录用户及评论双方可见
      1. 思绪的空中生活
        @emperinter

        把#注释 删掉
        我自己测试可用的

        1. bhklin
          @思绪的空中生活

          nginx
          那里保存不了,想把提示的英文发出来的,但提示不能发表

          1. 思绪的空中生活
            @bhklin

            是修改配置那里吗?
            再发一次看看

            1. bhklin
              @思绪的空中生活

              error
              nginx: [emerg] "location"directive is not allow
              ed here in/www/server/nginx/conf/nginx.con
              f:88
              nginx:configuration file/www/server/nginx/c
              onf/nginx.conf test failed

              1. 思绪的空中生活
                @bhklin

                修改的配置文件 你要把我里面的中文和#删除

                1. bhklin
                  @思绪的空中生活

                  从另外一个教程看到原来不是nginx的设置,
                  是直接点击刚设置好的网站跳出来的配置文件

                2. bhklin
                  @思绪的空中生活

                  今天我又试了下,宝塔面板中进入文件直接下载 删除 修改好上传,/www/server/nginx/conf/nginx.conf 但nginx点击启动会显示错误
                  面板中打开nginx.conf 点击保存也是保存不了,点击 全部保存是可以保存,把添加的内容删掉后是可以保存 随便按个字母也是不可以保存,按个空格可以

                3. bhklin
                  @思绪的空中生活

                  ;号以后的我都是删掉的,

    Leave a Comment Cancel reply