A comprehensive guide and automation toolkit for setting up secure, production-ready VPS servers with automated deployment capabilities for Laravel, Vue.js, and Next.js applications.
- Features
- Quick Start
- Prerequisites
- Installation
- Usage
- Project Types
- GitHub Actions Integration
- Security Features
- Backup & Recovery
- Monitoring
- Contributing
- License
- π Secure Server Setup: SSH key authentication, firewall configuration, and security hardening
- π Multi-Stack Support: Laravel (PHP), Vue.js (SPA), and Next.js (SSR) applications
- π§ Automated Configuration: One-command project creation with database setup
- π¦ SSL/TLS: Automatic Let's Encrypt certificate generation and renewal
- π CI/CD Ready: GitHub Actions workflows for automated deployment
- πΎ Backup System: Automated backups with restore capabilities
- π Monitoring: Built-in performance monitoring tools
- π Database Management: MySQL with phpMyAdmin integration
- π FTP Support: Secure FTP server configuration
-
Clone this repository:
git clone https://github.com/yourusername/server-setup-automation.git cd server-setup-automation -
Run the initial server setup:
chmod +x scripts/initial-setup.sh ./scripts/initial-setup.sh
-
Create your first project:
sudo bash scripts/create-project.sh example.com laravel
- Ubuntu 20.04+ VPS server
- Root access to the server
- Domain name pointing to your server's IP
- SSH client on your local machine
Follow the step-by-step guide in docs/INSTALLATION.md for detailed installation instructions.
Use the provided scripts for automated setup:
# Initial server setup
./scripts/initial-setup.sh
# Install automation tools
./scripts/install-automation.sh# Laravel project
sudo bash scripts/create-project.sh yourdomain.com laravel
# Vue.js project
sudo bash scripts/create-project.sh yourdomain.com vue
# Next.js project
sudo bash scripts/create-project.sh yourdomain.com next# List all projects
./scripts/list-projects.sh
# Backup a project
./scripts/backup-project.sh yourdomain.com
# Restore from backup
./scripts/restore-backup.sh- PHP 8.2 with FPM
- MySQL database with automatic user creation
- phpMyAdmin with HTTP authentication
- Composer dependency management
- Laravel-specific optimizations
- Static file serving with Nginx
- Asset optimization and caching
- SEO-friendly configuration
- Build process automation
- PM2 process management
- Automatic port assignment
- Static asset optimization
- Server-side rendering support
This repository includes ready-to-use GitHub Actions workflows for automated deployment:
- Laravel Deployment:
.github/workflows/laravel-deploy.yml - Vue.js Deployment:
.github/workflows/vue-deploy.yml - Next.js Deployment:
.github/workflows/nextjs-deploy.yml
Configure these secrets in your GitHub repository:
SSH_PRIVATE_KEY: Your server's SSH private keySERVER_HOST: Your server's IP address or domainSERVER_PORT: SSH port (default: 22)SERVER_USER: SSH username (default: admin)SUDO_PASSWORD: Sudo password for the server user
- SSH Key Authentication: Password-less login with ED25519 keys
- Firewall Configuration: UFW with minimal required ports
- SSL/TLS Encryption: Automatic Let's Encrypt certificates
- Database Security: Secure MySQL configuration
- File Permissions: Proper ownership and permission settings
- HTTP Authentication: phpMyAdmin access protection
Backups run automatically every Friday at 2:00 AM and include:
- Web files (
/var/www) - Nginx configuration (
/etc/nginx) - MySQL databases (
/var/lib/mysql)
./scripts/backup-project.sh yourdomain.com./scripts/restore-backup.shBuilt-in monitoring tools:
- htop: System resource monitoring
- vnstat: Network usage tracking
- PM2: Process monitoring (for Next.js projects)
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
- π Documentation
- π Issue Tracker
- π¬ Discussions
- Let's Encrypt for free SSL certificates
- Nginx for the web server
- PM2 for process management
- GitHub Actions for CI/CD
Made with β€οΈ for developers who value automation and security