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)
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.
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.