DEV Community

Cover image for 🚀 Laravel Server Auto-Installer – Deploy Laravel on a Fresh VPS in Minutes!
Mehrdad Dadashi
Mehrdad Dadashi

Posted on • Edited on

🚀 Laravel Server Auto-Installer – Deploy Laravel on a Fresh VPS in Minutes!

Introduction

Setting up a production-ready Laravel server from scratch can be a real headache — from installing PHP and Nginx to configuring SSL, Redis, and MySQL, it can easily take hours.

I’ve been working with Laravel and server administration for over a decade, and I’ve faced this challenge countless times. That’s why I created a fully automated Laravel Server Installer: a single Bash script that sets up your entire environment in under 10 minutes.


Why This Script?

If you’ve ever done a manual Laravel deployment, you know the pain:

  • Installing & configuring Nginx with PHP-FPM
  • Setting up MySQL securely
  • Enabling SSL with Let’s Encrypt
  • Installing Redis, Memcached, Composer, Node.js, and more
  • Configuring Supervisor for Laravel queues
  • Setting up backups and security

This script handles all of that automatically so you can focus on coding, not server setup.


Key Features

Nginx + PHP 8.3 with optimal PHP settings

MySQL secure installation + optimization config

Redis & Memcached for caching

phpMyAdmin integrated into the same vhost

Let’s Encrypt SSL via webroot method

Supervisor configuration for Laravel queues

Daily automatic backups (files + MySQL)

Full logging and saved credentials

Swap memory setup for better performance

✅ Ready for Ubuntu 20.04 & 22.04


Installation Guide

Requirements:

  • Fresh Ubuntu 20.04 or 22.04 server (root access)
  • A domain name pointing to your server’s IP
  • Basic knowledge of SSH
# Download the installer
wget https://raw.githubusercontent.com/mehrdad03/laravel-server-auto-installer/main/laravel-installer.sh

# Make it executable
chmod +x laravel-installer.sh

# Run the installer
sudo ./laravel-installer.sh
Enter fullscreen mode Exit fullscreen mode

During installation, the script will:

Ask for your main domain and SSL email

Install & configure all required services

Save all generated credentials in /root/server-credentials.txt

Set up automatic backups and security


⚙️ How It Works

Here’s what happens under the hood:

  1. System Preparation – Updates packages, sets timezone, creates swap file
  2. Security Setup – Firewall (UFW) configuration, SSH adjustments
  3. Nginx & PHP – Installs PHP 8.3 + extensions, configures Nginx vhost
  4. SSL – Automatically issues and configures Let’s Encrypt certificate
  5. MySQL – Secure installation + optimization config file
  6. phpMyAdmin – Integrated and protected under /phpmyadmin
  7. Caching – Redis & Memcached installation and tuning
  8. Supervisor – Config for Laravel queue workers
  9. Developer Tools – Composer, Node.js LTS, Yarn, PM2
  10. Backup Setup – Daily backup cron jobs for files and databases

📂 GitHub Repository

Laravel Server Auto Installer – View on GitHub

⭐ If you find it useful, please give the repo a star — it really helps others discover the project.


👨‍💻 About the Author

Hi, I’m Mehrdad Dadashi — a Laravel specialist with over 7 years of coding experience.

I help developers and companies build high-performance Laravel apps.

💬 Connect with me:

Top comments (3)

Collapse
 
lamri_abdellahramdane_15 profile image
Lamri Abdellah Ramdane

This is a fantastic tool for Laravel developers. It highlights a common problem of complex server setup and provides a single, powerful script to automate the entire process. This is exactly what Servbay is all about. It gives you a complete, pre-configured local development environment, so you can focus on building your app without the setup headaches, making it a perfect companion for a tool like this.

Collapse
 
mehrdad_dadashi_d4020898e profile image
Mehrdad Dadashi

Thank you so much for the detailed feedback, Lamri! 🙏 I totally agree — setting up a Laravel server manually can be time-consuming, and that’s exactly why I built this auto-installer. It’s great to hear you see the potential. Do you already use Servbay or a similar setup in your workflow?

Some comments may only be visible to logged-in visitors. Sign in to view all comments.