Share Local Laravel Installation using Ngrok

This shows how to share your Laravel Framework Installation on Mac OS X/linux with anyone using a browser and outside your network. Ngrok allows you to create a tunnel very fast for free and Laravel has an internal webserver that can be used without configuration. This is a terrific combination when you want to quickly show a demo  without updating an external Stage Server.

Note: This article assumes you have Laravel correctly installed.

1. Download and prepare Ngrok

First download the Ngrok binary. Choose your OS (Mac OS X or a Linux Distro). No more dependencies are needed.

Then locate the downloaded file, unzip it and move it to a place available on the PATH (you need sudo credentials).

unzip /path/to/ngrok.zip
sudo mv /path/to/ngrok /usr/local/bin/

After this you can test Ngrok by running: ngrok version from anywhere on the filesystem. You should see the version number (1.7 when this recipe was written).

Additional info: Ngrok website

2. Serve your Laravel Installation

Open a console window. Go to your Laravel Installation and turn on the artisan server. We will be using 127.0.0.1 instead of localhost (default).

Leave the console and the artisan serve process running. This is the Webserver listening for requests.

Additional info: Laravel Framework

3. Share your Laravel installation!

Open an extra console window and run ngrok:

ngrok 8000

You should see something like:

Tunnel Status                 online
Version                       1.7/1.6
Forwarding                    http://284abb77.ngrok.com -> 127.0.0.1:8000

This is the URL that you can share with anyone you want: http://284abb77.ngrok.com. The user accessing it will see your Laravel Installation running at 127.0.0.1:8000.

Just remember to turn off Ngrok (CTRL C) when you want to stop sharing.