Skip to main content

Lesson 7 of 8

Mini Project: Blog System - Part 12 (Complete Production Deployment)

The final project - deploy the complete Blog System to a production VPS with Nginx + PHP-FPM + MySQL + Redis, configure SSL, run the full quality pipeline (PHPStan + PHPUnit), set up cron jobs, and verify the production checklist. This is the capstone of the entire course.

20 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Blog System - Production Deployment

Blog System - Production Deployment
# ── Final Blog System - complete deploy checklist ────────────

# 1. QUALITY GATE (run locally before deploy)
composer qa   # PHPUnit + PHPStan + PSR-12

# Expected output:
# PHPUnit 11: 42 tests, 156 assertions - OK
# PHPStan: 0 errors (level 8)
# PHPCS: 0 errors

# 2. GIT TAG release
git tag v1.0.0
git push origin main --tags

# 3. SSH to production server
ssh deploy@blog.example.com

# 4. Run deploy.sh (atomic symlink deploy from Module 12)
bash /var/www/html/blog/deploy.sh

# 5. Verify deployment
curl -I https://blog.example.com/api/v1/posts
# HTTP/2 200 ✓
# x-raterlimit-limit: 60 ✓
# content-type: application/json ✓

curl https://blog.example.com/api/v1/posts | python3 -m json.tool
# { "success": true, "data": [...], "meta": {...} }

# 6. Run post-deploy checks
php /var/www/html/blog/current/cli/blog cache:clear --force
php /var/www/html/blog/current/cli/blog db:status

# 7. Set up cron jobs (crontab -e)
# Publish scheduled posts every 5 min
*/5 * * * * php /var/www/html/blog/current/cli/blog publish:scheduled --limit=10 >> /var/log/blog-publish.log 2>&1
# Daily cleanup of expired tokens and sessions
0 3 * * * php /var/www/html/blog/current/cli/blog tokens:prune >> /var/log/blog-cleanup.log 2>&1
# Weekly exports
0 0 * * 0 php /var/www/html/blog/current/cli/blog posts:export >> /var/log/blog-export.log 2>&1

# 8. Verify Opcache
curl -k https://blog.example.com/admin/opcache-status
# { "enabled": true, "hit_rate": "99.7%", "memory_free_mb": 128 }

# 9. Verify security headers
curl -I https://blog.example.com/
# x-frame-options: DENY ✓
# x-content-type-options: nosniff ✓
# strict-transport-security: max-age=31536000... ✓
# content-security-policy: ... ✓

# 10. Verify SSL
echo | openssl s_client -connect blog.example.com:443 2>/dev/null | openssl x509 -noout -dates
# notBefore=... notAfter=...   ← 90 days from now (Let's Encrypt)

<?php
// ── What you built across 12 modules ────────────────────────

# Module  1: PHP Fundamentals, environment, error reporting
# Module  2: Functions, arrays, strings, regex, DateTime
# Module  3: HTTP, forms, sessions, cookies, file uploads
# Module  4: OOP classes, inheritance, abstract, magic methods
# Module  5: Interfaces, traits, namespaces, SOLID, DI
# Module  6: PDO, CRUD, transactions, indexes, hydration
# Module  7: SQL injection, XSS, CSRF, bcrypt, security headers
# Module  8: File handling, JSON, CSV, streams, media serving
# Module  9: REST API, routing, auth (API key/Bearer/JWT), rate limiting
# Module 10: MVC, middleware pipeline, events, Monolog, patterns
# Module 11: Opcache, APCu/Redis cache, CLI tools, PHPUnit, PHPStan
# Module 12: Testing, Laravel intro, Nginx config, VPS deployment

// You now know:
// ✅ How to build a secure, tested, production-grade PHP backend
// ✅ How to design REST APIs with proper auth and rate limiting
// ✅ How to structure PHP with MVC, DI, and SOLID
// ✅ How to deploy and operate PHP on a production VPS
// ✅ What Laravel provides and why you'd use it

// Next steps:
// → Laravel (artisan, Eloquent, queues, Breeze, Livewire)
// → PHP 8.3+ features (readonly classes, typed class constants)
// → Queue workers (Laravel Horizon, Beanstalkd)
// → Microservices (Docker, gRPC, message queues)
// → Serverless PHP (Bref.sh on AWS Lambda)

Quick Quiz

Module Quiz

Module Quiz
Question 1 of 5

What does atomic deployment with symlinks guarantee?

Tip

Tip

Practice Mini Project Blog System Part 12 Complete Production Deployment in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.

Diagram
Loading diagram…

Visual architecture and concepts for Mini Project: Blog System - Part 12 (Complete Production Deployment)

Practice Task

Note

Practice Task - (1) Write a working example of Mini Project Blog System Part 12 Complete Production Deployment from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.

Common Mistake

Warning

A common mistake with Mini Project Blog System Part 12 Complete Production Deployment is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready php code.

Hands-on Practice Tools for this Course

Test what you learn using these free in-browser developer utilities (no signup required).

All 40+ Tools

Topics in This Module

0/8 done

Final Projects

Congratulations on completing the course! Apply everything you've learned by building one of these real-world projects.

Project 1: Blog CMS

Intermediate

Build a complete blog CMS with admin panel, posts, categories, and user management.

PHPMySQLBootstrap
Key features
Admin dashboard Post editor SEO meta fields Comment moderation
18-24 hoursGoal: A deployable blog platform.

Project 2: E-Commerce Platform

Advanced

Create a full e-commerce site with shopping cart, payment, and order management.

PHPLaravelStripeMySQL
Key features
Product management Cart & checkout Payment processing Admin orders
26-34 hoursGoal: A complete e-commerce solution.

Project 3: REST API with Laravel

Advanced

Build a secure, documented REST API using Laravel with Sanctum authentication.

LaravelPHPSanctumOpenAPI
Key features
Token auth Resource controllers API versioning Swagger docs
18-24 hoursGoal: A professional PHP API service.