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.