Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up ngrok an homestad

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.

like image 954
Ludwig Avatar asked Oct 09 '16 18:10

Ludwig


3 Answers

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.

like image 25
Yevgeniy Afanasyev Avatar answered Sep 26 '22 02:09

Yevgeniy Afanasyev


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
like image 45
gradosevic Avatar answered Sep 26 '22 02:09

gradosevic


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

like image 150
Anandhan Avatar answered Sep 27 '22 02:09

Anandhan