Using ngrok with Laravel

When developing a web application, it's common to want to test it on multiple devices or share it with others before deploying it to a production environment. One way to do this is by using a tool called ngrok, which creates a secure tunnel to your local development server and exposes it to the internet.

In this tutorial, we'll go through the steps of installing and using ngrok with Laravel on Ubuntu.

 

Install ngrok

To install ngrok, follow these steps:

  1. Go to the ngrok website and sign up for a free account.
  2. Download the ngrok binary for Linux by running the following command:
    wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
  3. Unzip the downloaded file:
    unzip ngrok-stable-linux-amd64.zip
  4. Move the ngrok binary to a directory in your PATH:
    sudo mv ngrok /usr/local/bin/

 

Start Laravel's development server

To start Laravel's development server, open a terminal and navigate to your Laravel project's directory. Then, run the following command:

php artisan serve

This will start the development server on http://localhost:8000.

 

Start ngrok

To start ngrok, open a new terminal and run the following command:

ngrok http 8000

 

Test the ngrok tunnel

To test the ngrok tunnel, open a web browser and navigate to one of the Forwarding URLs that you noted in the previous step. You should see your Laravel application running.

Congratulations! You've now successfully set up ngrok with Laravel on Ubuntu

laravel ngrok ubuntu

Leave a Reply



logo

© 2025. All rights reserved by Viktor Molnar.