Grok 是一个内网穿透工具,它允许将本地运行的服务暴露到公网上。不过,Grok 并不是一个独立的服务器软件,而是一个反向代理工具,通常与内网穿透服务一起使用,如Ngrok。以下是使用Ngrok进行内网穿透的基本步骤:
yum install git
wget https://golang.org/dl/go1.17.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.17.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
/usr/local/ngrok
,然后克隆Ngrok的GitHub仓库:mkdir /usr/local/ngrok
cd /usr/local/ngrok
git clone https://github.com/inconshreveable/ngrok.git
openssl genrsa -out rootCA.key 2048
openssl req -new -x509 -nodes -key rootCA.key -subj "/CN=ngrok.example.com" -days 5000 -out rootCA.pem
openssl genrsa -out server.key 2048
openssl req -new -key server.key -subj "/CN=ngrok.example.com" -out server.csr
openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 5000
cd /usr/local/ngrok
make release-server release-client
ngrok.yml
并配置服务器信息:server_addr: "ngrok.example.com:4443"
trust_host_root_certs: false
tunnels:
example:
proto: http
addr: 127.0.0.1:8080
./bin/ngrokd -tlsKey server.key -tlsCrt server.crt -domain ngrok.example.com -httpAddr :80 -httpsAddr :443
./ngrok authtoken your_auth_token
./ngrok http 8080
http://ngrok.example.com
,即可看到Ngrok的管理界面,并通过生成的URL访问本地服务。请注意,上述步骤是基于Ngrok的常规使用流程,具体操作可能会因版本更新或特定需求而有所不同。建议参考Ngrok的官方文档以获取最准确的安装指南。