Reputation: 339
ngrok use port 80, apache or nginx use port 80 too. I want run ngrok and web in one server and use port 80 and use sub domain to distinguish them.
e.g. ngrok running at tunnel.mysite.com and nginx's web running at web.mysite.com
How to do that?
Thanks!
Upvotes: 1
Views: 4535
Reputation: 692
You can't have both listening on the same port.
You could change the port for ngrok
(e.g. to 8080) and then setup a new virtual host in nginx
to reverse proxy http://tunnel.mysite.com to http://ngrok:8080.
Example nginx config:
server {
server_name web.mysite.com;
...
}
}
server {
server_name tunnel.mysite.com;
location / {
proxy_pass http://ngrok_IP:8080;
}
}
Upvotes: 3