2022-07-19 21:56:38 +08:00
|
|
|
|
# Ngrok 设置和使用
|
|
|
|
|
|
2022-07-19 21:59:55 +08:00
|
|
|
|
Ngrok 可实现内网穿透。
|
|
|
|
|
|
2022-07-19 21:56:38 +08:00
|
|
|
|
官网和下载地址:<https://dashboard.ngrok.com>
|
|
|
|
|
|
2024-07-05 11:20:01 +08:00
|
|
|
|
配置文件参考 cpolar,基本格式如下:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
authtoken: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
|
|
|
log_level: info
|
|
|
|
|
log: /path/to/ngrok.log
|
|
|
|
|
update: false
|
|
|
|
|
update_channel: stable
|
|
|
|
|
tunnels:
|
|
|
|
|
tty:
|
|
|
|
|
proto: tcp
|
|
|
|
|
addr: 22
|
|
|
|
|
version: "2"
|
|
|
|
|
region: us
|
|
|
|
|
```
|
2022-07-19 21:56:38 +08:00
|
|
|
|
|
|
|
|
|
参考 Systemd 文件:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=Ngrok Service
|
|
|
|
|
After=syslog.target
|
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
RestartSec=2s
|
|
|
|
|
Type=simple
|
|
|
|
|
User=rick
|
|
|
|
|
Group=rick
|
2024-07-05 11:18:16 +08:00
|
|
|
|
ExecStart=/<path>/<to>/ngrok --config /<path>/<to>/ngrok.yml start <channel name>
|
2022-07-19 21:56:38 +08:00
|
|
|
|
Restart=always
|
|
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
|
```
|