白嫖 fly.io 服务器

您所在的位置:网站首页 flo服务器 白嫖 fly.io 服务器

白嫖 fly.io 服务器

2023-10-03 00:01| 来源: 网络整理| 查看: 265

最近发现一个基于 Docker 的 Serverless 服务:fly.io,灵活度很高。免费额度如下,大致意思就是免费创建三个最低配的应用,最关键的是还附带独立的 IPv4 地址

说明

不要再搭建代理服务了,被检测出来如果未及时删除会收费的

白嫖准备

注册账号(需要信用卡验证,国内银联的卡也可以)

安装 flyctl

本机需要安装 docker

为了避免网络问题失败,我是在虚拟机内连接到 Windows 上的代理操作的,如果网络畅通可跳过此步骤

export HTTP_PROXY=http://192.168.0.104:8889 export HTTPS_PROXY=http://192.168.0.104:8889

设置 docker 代理,避免 deploy 时推送镜像失败

/etc/systemd/system/docker.service.d/http-proxy.conf [Service] Environment="HTTP_PROXY=http://192.168.0.104:8889" Environment="HTTPS_PROXY=http://192.168.0.104:8889" sudo systemctl daemon-reload sudo systemctl restart docker 创建应用

登录账号

ln ~/.fly/bin/flyctl /usr/local/bin/flyctl flyctl auth login --email xxxx --password xxxx

创建应用

名字是全局唯一的,随机生成一个即可。服务器地区测试下来香港是最快的,其次是日本,选择香港即可

flyctl launch

创建完成后会生成一个fly.toml文件,这个就是应用的配置文件了

创建应用

先跑个 openresty 试试,创建Dockerfile文件

FROM openresty/openresty:1.19.9.1-5-buster-fat COPY ./nginx.conf /usr/local/openresty/nginx/conf/nginx.conf ENV TZ=Asia/Shanghai EXPOSE 80 443 8899

修改fly.toml文件,通过 services 对外暴露端口

services.internal_port: app 在 docker 内的端口

services.ports.port: 绑定到 IP 上的端口,只有这里配置了才能通过 IP/域名访问

app = "你的应用ID" kill_signal = "SIGINT" kill_timeout = 5 processes = [] [[services]] internal_port = 80 protocol = "tcp" [[services.ports]] handlers = ["http"] port = 80 [services.concurrency] hard_limit = 100 soft_limit = 100 [[services]] internal_port = 8899 protocol = "tcp" [[services.ports]] # 不写handlers默认是透传 https://fly.io/docs/reference/services/#tcp-pass-through port = 8899 [services.concurrency] hard_limit = 100 soft_limit = 100

部署应用

flyctl deploy

执行flyctl ips list或者到网页上即可得到 IP 地址进行访问

部署 v2ray

由于服务器在国外,所以很适合搭建 v2ray 服务,毕竟这才是白嫖的意义

这里使用的镜像是teddysun/v2ray,配置参考自v2ray4flyio

config.json

里面的 id 是 uuid4 字符串,相当于连接密码,可随意替换

{ "log": { "loglevel": "warning" }, "inbounds": [ { "listen": "0.0.0.0", "port": 443, "protocol": "vmess", "settings": { "clients": [ { "id": "cbdacb10-40af-4a13-b396-3298a4024113", "alterId": 0 } ], "disableInsecureEncryption": true }, "streamSettings": { "network": "ws" } } ], "outbounds": [ { "protocol": "freedom" } ] }

Dockerfile

FROM teddysun/v2ray:5.0.3 COPY ./config.json /etc/v2ray/config.json EXPOSE 443

fly.toml

app = "你的应用ID" kill_signal = "SIGINT" kill_timeout = 5 processes = [] [[services]] internal_port = 443 protocol = "tcp" [[services.ports]] port = 443 [services.concurrency] hard_limit = 150 soft_limit = 150

测试连接速度一般,这里使用的是Qv2ray,不过用来查个资料足够了,注意不要超额导致扣费



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3