小兔网

如果是新的vps,需要安装必要的工具:

yum updateyum install -y vim wget curl

需要将系统时间改为东八区,即上海时间:

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
wget https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh
bash install-release.sh
  • /usr/local/bin/v2ray:V2Ray 程序;
  • /usr/local/bin/v2ctl:V2Ray 工具;
  • /usr/local/etc/v2ray/config.json:配置文件;
  • /usr/local/share/v2ray/geoip.dat:IP 数据文件
  • /usr/local/share/v2ray/geosite.dat:域名数据文件
wget https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh && bash install-dat-release.sh
bash install-release.sh --remove
cd /usr/local/etc/v2ray && wget -O config.json https://raw.githubusercontent.com/eebond/banwagong/main/V2rayN/config.json
vim /usr/local/etc/v2ray/config.json
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 10086,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "2e82cf13-4e82-4935-9ec7-23d0e0eb56b3",
"level": 1,
"alterId": 0
}
]
},
"streamSettings": {
"network": "ws",
"security": "none",
"wsSettings": {
"path": "/vmess"
}
}
},
{
"listen": "127.0.0.1",
"port": 12345,
"protocol": "vless",
"settings": {
"decryption": "none",
"clients": [
{
"id": "b123c75b-ebdf-006a-eeea-bcf6a8242e42",
"level": 0
}
]
},
"streamSettings": {
"network":"ws",
"security": "none",
"wsSettings":{
"path":"/vless",
"headers":{}
}
}
},
{
"port": 51888,
"protocol": "shadowsocks",
"settings": {
"method": "aes-256-gcm",
"password": "www.bannedbook.org",
"network": "tcp,udp",
"level": 0
}
}
],
"outbounds": [{
"protocol": "freedom",
"settings": {}
},{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}],
"routing": {
"rules": [
{
"type": "field",
"ip": ["geoip:private"],
"outboundTag": "blocked"
}
]
}
}
v2ctl uuid
systemctl start v2ray
systemctl enable v2ray
v2ray -test -config /usr/local/etc/v2ray/config.json

接下来看看 V2ray 是不是真的运行起来了:

systemctl status v2ray
systemctl status v2ray
service v2ray restart | force-reload |start|stop|status|reload

TIPS
此时已经可以通过V2ray实现上外网了。

https://eebond.github.io/centos7/centos-xia-shi-yong-certbot-shen-qing-bu-shu-let-s-encrpyt-mian-fei-ssl-zheng-shu-ngingx-fu-wu-qi/

wget -O /etc/nginx/conf.d/cloud.conf  https://raw.githubusercontent.com/eebond/banwagong/main/Nginx/conf.d/blog.conf
vim /etc/nginx/conf.d/blog.conf
    server {        listen       80;        listen       [::]:80;        server_name  blog.eebond.xyz;        rewrite ^(.*)$ https://$host$1 permanent;    }# Settings for a TLS enabled server.    server {        listen       443 ssl http2;        listen       [::]:443 ssl http2;        server_name  blog.eebond.xyz;        root         /srv/www/blog;        ssl_certificate "/etc/letsencrypt/live/blog.eebond.xyz/fullchain.pem";        ssl_certificate_key "/etc/letsencrypt/live/blog.eebond.xyz/privkey.pem";        ssl_session_cache shared:SSL:1m;        ssl_session_timeout  10m;        ssl_ciphers HIGH:!aNULL:!MD5;        ssl_prefer_server_ciphers on;        # Load configuration files for the default server block.        include /etc/nginx/default.d/*.conf;        error_page 404 /404.html;            location = /40x.html {        }        error_page 500 502 503 504 /50x.html;            location = /50x.html {        }        location /vmess {            if ($http_upgrade != "websocket") {            return 404;            }            proxy_redirect off;            proxy_pass http://127.0.0.1:10086;            proxy_http_version 1.1;            proxy_set_header Upgrade $http_upgrade;            proxy_set_header Connection "upgrade";            proxy_set_header Host $host;            proxy_set_header X-Real-IP $remote_addr;            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        }        location /vless {            if ($http_upgrade != "websocket") {                return 404;            }            proxy_redirect off;            proxy_pass http://127.0.0.1:12345;            proxy_http_version 1.1;            proxy_set_header Upgrade $http_upgrade;            proxy_set_header Connection "upgrade";            proxy_set_header Host $host;            proxy_set_header X-Real-IP $remote_addr;            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        }    }



相关文章:

Linux CentOS版本安装V2Ray

CentOS 7 搭建 V2Ray安装教程

CentOS 8上基于nginx搭建v2ray服务端配置vmess+tls+websocket图文教程