参考sgekecr::https://www.t00ls.net/thread-51441-1-2.html
环境为debian win10 绑定CF的域名一个
1、域名在Cloudflare添加域名开启cdn
2、
(1)服务器:debian
安装apt install supervisor wget git
下载GO:
wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
tar -xzvf go1.12.5.linux-amd64.tar.gz -C /usr/bin
设置环境变量:
echo "export PATH=$PATH:/usr/bin/go/bin" >> ~/.profile
source ~/.profile
准备编译:
mkdir goflywaybuild && export GOPATH=$PWD/goflywaybuild
go get github.com/mitchellh/gox
go get -u -d github.com/coyove/goflyway/cmd/goflyway
cd $GOPATH/bin
编译:
./gox -os "windows linux" -arch amd64 $GOPATH/src/github.com/coyove/goflyway/cmd/goflyway
编译完成:
goflyway_linux_amd64 (服务器debian使用)和 goflyway_windows_amd64.exe (本地win10使用)
cp goflyway_linux_amd64 /usr/bin/goflyway
3、配置Supervisor文件
vi /etc/supervisor/conf.d/goflyway.conf
[supervisord] nodaemon=false
[program:goflyway]
priority=1
directory=/usr/bin
command=/usr/bin/goflyway -l=":我是cf允许的端口" -k="我是密码"
服务器启动:
service supervisord restart
或者直接
supervisord -c /etc/supervisor/conf.d/goflyway.conf
4、本地配置:
goflyway_windows_amd64.exe -l=":我是本地代理端口" -k="我是密码" -up="cf://我是套了CF的域名:我是cf运行的端口但要与服务端一致"
我使用winsw总是报错,也可以试试nssm.exe,参考:
浏览器配置:
5、运行结果
服务器:
本地: