这儿使用tengine进行安装, 能够看之前的博客php
./configure --with-http_v2_module
否则会报错html
此时安装的openresty配置http2会报错 the "http2" parameter requires ngx_http_v2_module
若是已经安装的ginx, 可使用 nginx -v
查看编译参数, 而后加上上述参数从新编译, 以后make
, 不执行 make install
, 而后将编译后的nginx进行替换现有的.python
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak cp objs/nginx /usr/local/nginx/sbin/nginx
user root; worker_processes 1; worker_rlimit_nofile 652144; error_log /usr/local/nginx/logs/error.log crit; pid /run/nginx.pid; events { use epoll; multi_accept on; worker_connections 1024; } http { include /usr/local/nginx/conf/mime.types; client_max_body_size 1m; sendfile on; tcp_nopush on; access_log off; keepalive_timeout 60; proxy_ignore_client_abort on; limit_req_zone $binary_remote_addr zone=allips:200m rate=90r/m; upstream vr_server { server 127.0.0.1:18181; keepalive 1000; } include conf.d/*.conf; }
server { listen 80; server_name vr.xxx.cn; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~/.well-known { allow all; } return 301 https://$server_name$request_uri; }
注意上面配置中的 location ~/.well-konw
, 这个在使用certbot的时候使用的linux
server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; ssl_certificate /etc/letsencrypt/live/vr.xxxxxxxx.cn/fullchain.pem; #生成的密钥对 #你的ssl证书, 若是第一次,可能还须要自签一下 ssl_certificate_key /etc/letsencrypt/live/vr.xxxxxxxx.cn/privkey.pem; #生成的密钥对, 你的ssl key server_name vr.xxxxxxxx.cn; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用的协议 ssl_ciphers HIGH:!aNULL:!MD5;#使用的加密算法 root /usr/local/nginx/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; location /bronk { proxy_redirect off; proxy_pass http://vr_server; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; } }
我没试验这个nginx
server { listen 80; server_name linuxstory.org www.linuxstory.org; return 301 https://$server_name$request_uri; }
system-cmd --zone=public --add-port=80/tcp --permanent system-cmd --zone=public --add-port=443/tcp --permanent
须要本身注册域名, 而且域名指向本身的服务器, 服务器的443和80端口都开着git
$ yum -y install yum-utils $ yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
yum install certbot python2-certbot-nginx
cerbot 签名有两种方式 一种是 --webroot 一种是 --Standalone 在网上看到的区别是 第一种不须要停如今的服务 第二种须要停掉服务 那好 我须要的是第一种 :)github
而后确认下你要签名的域名 是否已经指向你本身的服务器了 还有云服务的话 要记得看下安全组 443端口有没有开 总之就是要确认你的准备工做是没问题的web
location ~ /.well-known { allow all; }
看到另一种方式, 没有实验算法
location ^~ /.well-known/acme-challenge/ { default_type "text/plain"; root /home/wwwroot/linuxstory.org/; } location = /.well-known/acme-challenge/ { return 404; }
certbot certonly --webroot -w /usr/local/nginx/html -d vr.xxx.cn --email xxx@hotmail.com
服务器输出以下信息, 证实生成正确, 注意其中的目录地址shell
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/vr.xxxxxxxx.cn/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/vr.xxxxxxxx.cn/privkey.pem
Your cert will expire on 2019-09-12. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew all of your certificates, run
"certbot renew"- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
/etc/letsencrypt/live/你的域名/ 下存放的就是密钥
参照nginx下的v2r@y.conf 文件的配置
crontab -e
以后进行编辑
0 0 15 */3 * /usr/bin/certbot renew # 3,6,9,12月的15号零点进行更新
参考: http简介及ssl工具
bash <(curl -L -s https://install.direct/go.sh)
此脚本会自动安装以下文件
/usr/bin/v2r@y/v2r@y:v2r@y 程序;
/usr/bin/v2r@y/v2ctl:v2r@y 工具;
/etc/v2r@y/config.json:配置文件;
/usr/bin/v2r@y/geoip.dat:IP 数据文件
/usr/bin/v2r@y/geosite.dat:域名数据文件 此脚本会配置自动运行脚本。自动运行脚本会在系统重启以后,自动运行 v2r@y。目前自动运行脚本只支持带有 Systemd 的系统,以及 Debian / Ubuntu 全系列。
运行脚本位于系统的如下位置:
/etc/systemd/system/v2r@y.service
: Systemd/etc/init.d/v2r@y
: SysVsystemctl start|stop|status|reload|restart|force-reload v2@ray
/etc/v2@ray/config.json
更改配置文件
{ "log" : { "access": "/var/log/v2r@y/access.log", "error": "/var/log/v2r@y/error.log", "loglevel": "warning" }, "inbound": { "port": 10000, //(此端口与nginx配置相关) "listen": "127.0.0.1", "protocol": "vmess", "settings": { "clients": [ { "id": "xxxxxxd1f-687c-4188-9abc-80073a618ca3", //你的UUID, 此ID需与客户端保持一致 "level": 1, "alterId": 64 //此ID也需与客户端保持一致 } ] }, "streamSettings":{ "network": "ws", "wsSettings": { "path": "/ray" //与nginx配置相关 } } }, "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" } ] } } }
{ "log": { "loglevel": "warning" }, "inbound": { "port": 1080, "listen": "127.0.0.1", "protocol": "socks", "settings": { "auth": "noauth", "udp": false } }, "inboundDetour": [ { "port": 8123, "listen": "127.0.0.1", "protocol": "http", "settings": {} } ], "outbound": { "protocol": "vmess", "settings": { "vnext": [{ "address": "test.v2r@y.com", // 服务器地址,请修改成你本身的服务器 ip 或域名 "port": 443, // 服务器端口 "users": [{ "id": "4xxxxxxf-687c-4188-9abc-80073a618ca3", //你的UUID, 此ID需与服务端保持一致 "level": 1, "alterId": 64, //此ID也需与客户端保持一致 "security": "aes-128-gcm" }] }] }, "streamSettings":{ "network": "ws", "security": "tls", "tlsSettings": { "serverName": "test.v2r@y.com" //此域名是你服务器的域名 }, "wsSettings": { "path": "/ray" //与服务器配置及nginx配置相关 } }, "tag": "forgin" }, "outboundDetour": [ { "protocol": "freedom", "settings": {}, "tag": "direct" } ], "routing": { //此路由配置是自动分流, 国内IP和网站直连 "strategy": "rules", "settings": { "domainStrategy": "IPIfNonMatch", "rules": [ { "type": "chinaip", "outboundTag": "direct" }, { "type": "chinasites", "outboundTag": "direct" }, { "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": "direct" } ] } }, "policy": { "levels": { "0": {"uplinkOnly": 0} } } }
下载客户端, (下载地址)[https://pan.laod.cc/download/]
v2r@yN
注意uuid 和服务端一致
使用v2r@yX 链接不上, 后使用v2r@yU进行链接的
wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
先选择2, 重启后选择7, 便可
碰到一个异常
rejected v2r@y.com/core/proxy/vmess/encoding: invalid user
是由于v2r@y 的uuid或者服务器时间和本地的不一致
更改服务器时区
timedatectl set-timezone Asia/Shanghai
若是服务器有ipv6, 那么使用全局模式能够自动ipv6