42 lines
678 B
Markdown
42 lines
678 B
Markdown
# Ngrok 设置和使用
|
||
|
||
Ngrok 可实现内网穿透。
|
||
|
||
官网和下载地址:<https://dashboard.ngrok.com>
|
||
|
||
配置文件参考 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
|
||
```
|
||
|
||
参考 Systemd 文件:
|
||
|
||
```bash
|
||
[Unit]
|
||
Description=Ngrok Service
|
||
After=syslog.target
|
||
After=network.target
|
||
|
||
[Service]
|
||
RestartSec=2s
|
||
Type=simple
|
||
User=rick
|
||
Group=rick
|
||
ExecStart=/<path>/<to>/ngrok --config /<path>/<to>/ngrok.yml start <channel name>
|
||
Restart=always
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
```
|