Setting up Nginx and PHP-fpm in Laravel Sail

Sam Ngu
4 min readMay 9, 2022

But Laravel Sail is meant for development right? Why bother with Nginx? Yeah I know I know, but sometimes there is always a need to use a proper web server. Whether you are trying to set up SSL to test HTTPS connections, transitioning from the development environment to production, or a need to test concurrent requests in your app.

Also watch this tutorial on my Youtube Channel:

Photo by giuseppe Peppe on Unsplash

TLDR;

  1. Copy and paste the files in this repo to your project.
  2. Edit nginx/sites/laravel.conf
  3. Copy the values in .env.example to the actual .env file.
  4. Edit your machine’s host file if needed to add a custom domain.
  5. Run docker-compose up -d and enjoy!

Note: this tutorial assumes familiarity with Docker.

The Problem with Laravel Sail

The default Laravel Sail container only exposes a web server powered by the built-in PHP development server. Although it is simple and nice, the built-in…

--

--