Chapter 11: Application Hosting — WordPress, Flask and Express
Practice Questions and Lab Exercises
Come on, now practice! Deploy the three apps yourself and make sure they come back after a reboot.
चला, आता प्रॅक्टिस! तिन्ही ॲप्स स्वतः डिप्लॉय करा आणि रीबूट करून ते परत येतात का ते नक्की बघा.
चलो, अब प्रैक्टिस! तीनों ऐप्स ख़ुद डिप्लॉय करो और रीबूट करके पक्का देखो कि वो वापस आते हैं या नहीं.
- List the steps to install WordPress on a LAMP server.
- Why does WordPress need
AllowOverride Allon Apache? What is the Nginx equivalent? - What SELinux changes are needed for WordPress on CentOS Stream 9 and why?
- Why shouldn't you use the Flask development server in production? What does
wsgi:appmean? - Explain the Nginx
location /static/block withalias. - What is pm2 cluster mode? What is the difference between
pm2 restartandpm2 reload? - Lab: Install WordPress on Ubuntu with Apache, attach an Elastic IP first, and publish a post.
- Lab: Install WordPress on Amazon Linux 2023 with Nginx + PHP-FPM.
- Lab: Deploy the Flask demo, then change the template, push/pull, and restart the service.
- Lab: Deploy the Express demo with pm2 cluster mode; reboot the instance and prove it came back automatically.
Got it? WordPress, Flask and Express – three apps, but one pattern: the app, a process manager and Nginx in front. Now let's move on to complete stacks.
समजलं का? WordPress, Flask आणि Express – तीन ॲप्स, पण पॅटर्न एकच: ॲप, प्रोसेस मॅनेजर आणि समोर Nginx. आता पुढे जाऊया पूर्ण स्टॅक्सकडे.
समझ आया? WordPress, Flask और Express – तीन ऐप्स, पर पैटर्न एक ही: ऐप, प्रोसेस मैनेजर और आगे Nginx. अब आगे चलते हैं पूरे स्टैक्स की तरफ़.
Quick Revision
- WordPress = PHP + MySQL: install stack → create DB/user → download →
wp-config.php+ salts → ownership (www-data/apache) → vhost withAllowOverride All(or Nginxtry_files ... /index.php?$args) → browser install. Use an Elastic IP. - Flask: venv → Gunicorn (
wsgi:app, 2×CPU+1 workers) → systemd → Nginxproxy_pass+/static/alias. - Express: NodeSource → pm2 (ecosystem file, cluster mode,
startup,save) → Nginx upstream + proxy. - CentOS:
httpd_can_network_connect,httpd_sys_rw_content_tfor writable folders.
Extended teaching notes
Why this lesson matters
Cloud security is mostly IAM, network exposure, logging and secure defaults. The shared responsibility model means the provider patches the metal; you patch what you configure.
- No public databases or public admin panels.
- Roles / OIDC instead of long-lived access keys.
- CloudTrail / Activity Logs / Audit Logs on and retained.
- S3/Blob/GCS: Block Public Access; encrypt; least privilege.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.