Simplify Laravel Deployment with an Automated Nginx Server Setup.

Simplify Laravel Deployment with an Automated Nginx Server Setup.

Setting up an Nginx server to deploy Laravel applications can be a daunting task, especially for developers who don’t work on servers every day. The process often involves installing and configuring multiple dependencies such as PHP extensions, Node.js, MySQL, Certbot, Composer, and more. Typically, we find ourselves Googling commands, asking ChatGPT for help, or referring to saved notes to copy-paste commands manually.

But what if there was a way to automate the entire process? Imagine having a single command that you run on your server, input some basic details like your project name, PHP version, Node.js version, domain name, and GitHub repository URL, and everything gets set up automatically—your project is ready to go live!

Sounds amazing, right? That’s exactly what I’ve created—a bash script to simplify and speed up server setup and Laravel project deployment. With this script, you can configure your Nginx server and deploy your Laravel app in just 5 minutes without the usual hassle.

How to Use the Script

To set up your Nginx server and deploy your Laravel application, simply run the following command on your server:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/muhaiminShihab/project-deployment/main/setup.sh)"

Once you execute this command, the script will prompt you for the following details:

  • Project name

  • PHP version

  • Node.js version

  • Domain name

  • GitHub repository URL

Provide the requested information, and the script will handle the rest. It will download and configure all necessary dependencies, set up your environment, and deploy your Laravel project with an SSL Certificate automatically.

Contribute and Improve the Script

If you want to explore the script further or contribute to its improvement, visit the GitHub repository. Don’t forget to give it a star, fork the repository, and share your contributions to help make it even better!

Inspirations

I got the inspiration to build this script from Mr. Shohag. Thank you for the amazing idea.