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:
TLDR;
- Copy and paste the files in this repo to your project.
- Edit
nginx/sites/laravel.conf
- Copy the values in
.env.example
to the actual.env
file. - Edit your machine’s host file if needed to add a custom domain.
- 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…