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)

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