Chapter 7: Static Website Hosting (3 OSes × 2 Web Servers)
Practice Questions and Lab Exercises
Come on, practice time! Host your site on at least two combinations – once with Nginx, once with Apache – and the difference will stay with you for good.
चला, आता प्रॅक्टिस! कमीत कमी दोन कॉम्बिनेशन्सवर तुमची साइट होस्ट करा – एकदा Nginx, एकदा Apache – मग फरक कायमचा लक्षात राहील.
चलो, अब प्रैक्टिस! कम से कम दो कॉम्बिनेशन्स पर अपनी साइट होस्ट करो – एक बार Nginx, एक बार Apache – फिर फ़र्क हमेशा के लिए याद रहेगा.
- What is a static website? Give three examples.
- Write the document root, site config location and web-server user for all six combinations.
- Why do we run
restoreconon CentOS? What happens to SELinux labels when files are moved withmv? - Write an Nginx server block and an Apache virtual host for
college.example.comwith root/var/www/college. - A site gives 403 Forbidden. List four possible causes and how you would check each.
- Lab: Host your personal portfolio on Ubuntu + Nginx using
git clone. - Lab: Host the same site on CentOS Stream 9 + Apache. Deliberately
mva file from your home folder into the site and observe the 403; fix it withrestorecon. - Lab: Host two sites on one server using name-based virtual hosts and test with
curl -H "Host: ...".
Quick Revision
- Static site = files only. URL path maps to files under the document root.
- Steps: create/upload files → copy to
/var/www/mysite→755dirs /644files → vhost/server block → test config → reload → browse. - Nginx:
conf.d/*.conf(AL/CentOS) orsites-available+ symlink (Ubuntu). Apache:conf.d/*.conf(AL/CentOS) ora2ensite(Ubuntu). - CentOS extras:
restorecon -Rv, firewalld--add-service=http. - Troubleshoot:
curl -I localhost,ss -tlnp, error logs, security group. - Next: Chapter 8 explains every config line (root, ports, vhosts); Chapter 9 gives the site a real domain.
Got it? Files, folder, config, permissions, reload – and curl -I localhost from inside. Now let's move on to understanding the config files line by line.
समजलं का? फाइल्स, फोल्डर, कॉन्फिग, परमिशन्स, reload – आणि आतून curl -I localhost. आता पुढे जाऊया कॉन्फिग फाइल्स लाइन बाय लाइन समजायला.
समझ आया? फ़ाइलें, फ़ोल्डर, कॉन्फ़िग, परमिशन्स, reload – और अंदर से curl -I localhost. अब आगे चलते हैं कॉन्फ़िग फ़ाइलें लाइन बाय लाइन समझने.
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.