CentOS下搭建Ngrok内网穿透服务
作为一个程序员,没有公网IP怎么行呢?这里就来个内网穿透工具吧。
鉴于Ngrok存在小Bug,现已补充Frp内网穿透搭建教程(个人建议使用Frp)。
1.准备
首先你需要一个服务器,我的是腾讯云主机。
进行重装系统(为了避免不必要麻烦,非必须),选择CentOS。
然后设置域名指向你的服务器IP。
我的是使用了二级域名,即
ngrok.kioye.cn和 *.ngrok.kioye.cn 都使用A记录指向139.199.210.123
。
2.开始安装
# 安装依赖
yum -y install openssl-devel wget gcc gcc-c++
# 安装git
yum install git -y
# 安装go
yum install -y mercurial bzr subversion golang
# 查看go版本
go version
# 拉取ngrok源码
git clone https://github.com/inconshreveable/ngrok.git
# 生成证书
cd ngrok
export NGROK_DOMAIN="ngrok.kioye.cn"
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -subj "/CN=$NGROK