panyongwei / ngrok

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

请问安装ngrok 里面80端口能换别的吗? 好和我的ngnix避免冲突

hccgk opened this issue · comments

rt

install_ngrok 方法
/usr/local/ngrok/bin/ngrokd -domain=$NGROK_DOMAIN -httpAddr=":80"

你可以在nginx反响代理回来,你的ngrok采用别的端口,nginx方向代理ngrok的端口

@hccgk

我服务器上面是这样做的你可以参考下 supervisor 监控ngrokd进程

[program:ngrokd]
directory=/usr/local/ngrok/bin
command=/usr/local/bin/ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="example.com" -httpAddr=":8888" -httpsAddr=":8443"
autostart=true
autorestart=true
user=root
.....

下面是nginx 配置的反向代理

server {
        listen 80;
        server_name *.example.com;
        keepalive_timeout 70;
        proxy_set_header "Host" $host:8888;
        location / {
                proxy_pass_header Server;
                proxy_redirect off;
                proxy_pass http://127.0.0.1:8888;
        }
        access_log off;
        log_not_found off;
}