8

I am trying to setup ngrok on my homestead, but it is not opening my project. I have run ngrok http 80 and copied the address in forwarding part of the output to my Homestead.yaml file to map it to my project, and ran vagrant provision after that:

Forwarding                    http://92832de0.ngrok.io -> localhost:80
Forwarding                    https://92832de0.ngrok.io -> localhost:80

But when I open the http://92832de0.ngrok.io in the browser it opens up ngrok page "It works" and not my project.

When I have changed the port to ngrok http 8000 then I get Laravel error message:

Whoops, looks like something went wrong.

Ludwig
  • 1,401
  • 13
  • 62
  • 125

5 Answers5

17

You can use any of your application which is in homestead. For that, you need to run the below command by replacing 'your-site.app:8000'

ngrok http -host-header=rewrite your-site.app:8000

Before that, you need to register into ngrok and install ngrok then use the authtoken that given in your account.

For more details, refer this https://ngrok.com/docs

Anandhan
  • 667
  • 4
  • 9
6

This is how It worked for me:

1) I have downloaded the ngrok (https://ngrok.com/) on my Windows host machine and executed ngrok.exe. It has opened a command line interface for me

2) I typed the following

ngrok.exe http 192.168.10.10 -host-header=homestead.test

And it gave me the link of where to go:

Forwarding http://123456.ngrok.io -> http://192.168.10.10:80

Forwarding https://123456.ngrok.io -> http://192.168.10.10:80

I just went there ans saw my local environment Laravel Project.

Community
  • 1
  • 1
Yevgeniy Afanasyev
  • 37,872
  • 26
  • 173
  • 191
2

You can add a function like this to your ~/.profile or ~/.bash_profile script on the host machine:

rock(){
  ngrok http 192.168.10.10:80 -host-header=$1
}

After that you can use it to proxify any site on your Homestead machine like this:

rock your-site.app:8000
gradosevic
  • 4,809
  • 2
  • 36
  • 51
0

If you have multiple sites on your homestead you have to:

  1. ssh into your homestead.
  2. run this command: share yoursite.test

and that's it.

Mahdi Naderian
  • 101
  • 1
  • 4
0

In homestead ngrok is already installed by default, You just need to create an account from ngrok at https://dashboard.ngrok.com/signup

And then run:

  • vagrant up (in folder Homestead)

  • vagrant ssh

  • cd to/your/project/proyect

  • ngrok authtoken your__ngrok__account___token

  • share yourproject.test

Caro Pérez
  • 476
  • 4
  • 4