Mac内网穿透(ngrok)

背景:由于需要测试微信支付接口,所以需要用到内网穿透,(https内网穿透)。

1.注册ngrox

https://dashboard.ngrok.com/signup

2.登陆下载mac客户端

3.确认邮箱(会在登陆的主界面弹出邮箱确认)

4. 配置authtoken

ngrok config add-authtoken 2xxxxxxxxxxxxxxxxxxxxxxxxxxx

5.若出现  如下报错,则需要配置环境变量

zsh: command not found: ngrok 

环境变量配置:

vim ~/.bash_profile   添加如下:

export PATH=$PATH:/xxxngrok的路径/ngrok;

刷新环境变量:source ~/.bash_profile

6.需要给ngrok权限(直接终端执行即可)

chmod a+x ngrok

7.使用:

#将本地8080端口映射到外网
./ngrok http localhost:8080


结束,记得点个赞~

猜你喜欢

转载自blog.csdn.net/weiqiang915/article/details/126588828