GitHub - melancholic-ksm/AZ-Plan-detailed: Comprehensive Server/VM/VPS deployment toolkit with Nginx configuration, PHP setup, fail2ban security, Cloudflare certificate integration/Lets Encrypt server cert, and GitHub CI/CD pipelines. · GitHub
Skip to content

melancholic-ksm/AZ-Plan-detailed

Folders and files

Repository files navigation

Server Setup for Website Hosting

A comprehensive collection of scripts and documentation to prepare a fresh Ubuntu/Debian server for production website hosting with modern deployment practices.

🎯 What This Project Offers

This repository provides everything you need to:

  • Set up a production-ready web server with Nginx and PHP-FPM [PHP 8.3 most stable]
  • Secure your server with Fail2ban and SSL certificates
  • Choose your SSL method: Let's Encrypt (Certbot) OR Cloudflare Origin certificates
  • Optional MySQL/MariaDB database server with phpMyAdmin
  • GitHub CI/CD deployment - automatically deploy from GitHub on push
  • Multi-server sync with lsyncd - real-time file synchronization across multiple servers

🚀 Quick Start

Using Shell Scripts (Recommended)

The scripts/ folder contains ready-to-run shell scripts that automate the setup process, NOTE: replace example.com with your domain/subdomain name before you proceed;

# Clone the repository
git clone https://github.com/melancholic-ksm/AZ-Plan-detailed.git
cd AZ-Plan-detailed/scripts

# Make scripts executable
chmod +x *.sh

# Run the scripts in order:
sudo ./01-system-setup.sh              # System updates and essentials
sudo ./02-nginx-php-setup.sh example.com  # Nginx + PHP-FPM
sudo ./03-fail2ban-setup.sh            # Security with Fail2ban

# Choose ONE SSL method:
sudo ./04-certbot-ssl-setup.sh example.com  # Free Let's Encrypt SSL
# OR
sudo ./05-cloudflare-ssl-setup.sh example.com  # Cloudflare Origin SSL

# Optional components:
sudo ./06-mysql-setup.sh               # MySQL + phpMyAdmin
sudo ./07-lsyncd-setup.sh              # Multi-server file sync
sudo ./08-github-cicd-setup.sh         # GitHub Actions deployment

📁 Repository Structure

├── scripts/                      # Executable shell scripts
│   ├── 01-system-setup.sh       # System updates and essentials
│   ├── 02-nginx-php-setup.sh    # Nginx + PHP-FPM installation
│   ├── 03-fail2ban-setup.sh     # Fail2ban security setup
│   ├── 04-certbot-ssl-setup.sh  # Let's Encrypt SSL (free)
│   ├── 05-cloudflare-ssl-setup.sh # Cloudflare Origin SSL
│   ├── 06-mysql-setup.sh        # MySQL + phpMyAdmin (optional)
│   ├── 07-lsyncd-setup.sh       # lsyncd multi-server sync
│   └── 08-github-cicd-setup.sh  # GitHub Actions CI/CD setup
├── Github-cicd/                  # CI/CD documentation
├── lsyncd/                       # lsyncd setup guides
├── mysql/                        # MySQL troubleshooting guides
└── README.md

🔧 Deployment Options

Option 1: GitHub Actions CI/CD

Automatically deploy your website when you push to GitHub:

  1. Run ./08-github-cicd-setup.sh on your server
  2. Add the generated secrets to your GitHub repository
  3. Push to main branch - your site deploys automatically!

Features:

  • Uses rsync for efficient incremental updates
  • Supports multiple servers
  • Works with both GitHub-hosted and self-hosted runners

Option 2: lsyncd Real-time Sync

Keep multiple servers in sync in real-time:

  1. Run ./07-lsyncd-setup.sh on your main server
  2. Configure target servers
  3. Any file changes automatically sync to all servers

Use cases:

  • Multi-region deployments
  • High availability setups
  • Development to staging sync

🔐 SSL Certificate Options

Certbot (Let's Encrypt) - Free

  • Automatic certificate management
  • 90-day validity with auto-renewal
  • Requires public domain pointing to server
  • No Cloudflare required

Cloudflare Origin SSL

  • 15-year validity
  • Works behind Cloudflare proxy
  • Requires Cloudflare account
  • Recommended when using Cloudflare for DNS/CDN

📚 Documentation

For detailed step-by-step guides, see:

⚙️ Requirements

  • OS: Ubuntu 22.04/24.04 or Debian 11/12
  • Access: Root or sudo privileges
  • Network: SSH access to server
  • Domain: A domain name (for SSL)

🛡️ Security Notes

  • Always use strong passwords for MySQL and other services
  • Keep your SSH keys secure
  • Consider additional hardening (SSH key-only auth, custom SSH port)
  • Regularly update your system: sudo apt update && sudo apt upgrade

📝 License

This project is open source and available for personal and commercial use.

🤝 Contributing

Contributions are welcome! Feel free to submit issues and pull requests.

About

Comprehensive Server/VM/VPS deployment toolkit with Nginx configuration, PHP setup, fail2ban security, Cloudflare certificate integration/Lets Encrypt server cert, and GitHub CI/CD pipelines.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages