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
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:
- System Preparation β Updates packages, sets timezone, creates swap file
- Security Setup β Firewall (UFW) configuration, SSH adjustments
- Nginx & PHP β Installs PHP 8.3 + extensions, configures Nginx vhost
- SSL β Automatically issues and configures Letβs Encrypt certificate
- MySQL β Secure installation + optimization config file
-
phpMyAdmin β Integrated and protected under
/phpmyadmin - Caching β Redis & Memcached installation and tuning
- Supervisor β Config for Laravel queue workers
- Developer Tools β Composer, Node.js LTS, Yarn, PM2
- 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.