Ngrok: How to open port 80
Asked Answered
A

4

15

I have just installed ngrok on my local machine, ran

ngrok http 80

as usual.

However when I try to access port 80

localhost:80 

I get this error message

The connection to http://*******.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:80.

I am really unsure why this is occurring, and browsed around stackoverflow, but did not quite understand the answers I read. Hoping to diagnose afresh and build understanding from here.

OS is Mac OS.

Antigone answered 3/2, 2016 at 12:16 Comment(3)
Which OS are you using? On Linux/Unix open socket with port lower than 1024 is only allowed for root.Basketry
Likely means Mac , I have the same issue nowBacteriostasis
I have the same issue on Mac, anyone found a solution to this? Thanks.Ferwerda
P
13

ngrok enables us to connect with http://xxx.ngrok.io with local server. Yup, all you do is just running server such as Apache, nginx or something. It is allowed build-in local server in your language.

sudo apachectl start
ngrok http 80

If you love PHP, you can follow below.

php -S localhost:8080
ngrok http 8080

Good Luck :D

Piano answered 12/11, 2016 at 22:44 Comment(2)
Using ruby on Mac, you can start a local server with: "ruby -run -e httpd . -p [port number]" from the project root directory, then: "ngrok http [port number]" (create symlink to run ngrok from any directory)Sayce
Perfect answer 🙏Forbore
D
3

Try this to connect your local server to Ngrok. Start your server on the local host and expose the server port to Ngrok.

Lets say I am a running a rails app. To start my local server, I will hit

rail server

The default rails local host is

localhost:3000

And not localhost:8080

Enter localhost:3000 into your browser and ensure that it calls up your application. Once that's done, open your terminal or command line interface and type

ngrok http 3000

And not ngrok http 8080 or ngrok http 80, since your default port is 3000 and not 8080 or 80, except if you eventually change it to another port.

This should open up a GUI on the terminal, that shows all the network statistics and publicly accessible urls for the local server instance.

Open your preferred web browser and load either urls that are displayed next to “Forwarding”. e.g: https://.ngrok.io/api/v1/login

That’s all. You now have a web sever which is accessible from anywhere in the world.

That's all

I hope this helps.

Denby answered 25/2, 2019 at 10:8 Comment(0)
M
2

Simply do this

  1. Start your server using rail server
  2. Open your terminal and enter ngrok http 3000

N/B: The default rails local host is localhost:3000

This will generate some links for accessing your local host Copy the links and paste in your browser.

This worked for me.

Majewski answered 16/7, 2019 at 16:9 Comment(0)
P
1

I was working on a Rails app I wanted to run it on ngrok but I got error below:

The connection to http://xxxxxx.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:3000.

It seems like ngrok works fine but my local server is not. Which is true since I forgot to run my rails app first by run $ rails s. After run my local server 3000 I was able to get ngrok works fine.

Once your local server runs first, head to your ngrok url and it should run as expected.

Good luck.

Pocosin answered 15/10, 2017 at 20:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.