ngrok使用nginx实现80端口代理

upstream ngrok {  
    server 127.0.0.1:8810; # 此处端口要跟 启动服务端ngrok时指定的端口一致
    keepalive 64;
}
server {  
    listen       80;
    server_name  *.ngrok.test.com;
    #charset koi8-r;

    location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host  $http_host:8810; #此处端口要跟 启动服务端ngrok 时指定的端口一致
            proxy_set_header X-Nginx-Proxy true;
            proxy_set_header Connection "";
            proxy_pass      http://ngrok;
    }
}

引用链接:http://www.wxapp-union.com/portal.php?mod=view&aid=1148

展示评论