Chapter 7: Static Website Hosting (3 OSes × 2 Web Servers)
7.11 Combination 6 — CentOS Stream 9 + Apache
The last combination – CentOS and Apache. By now you can see the pattern: install, vhost, restorecon, firewalld, test and reload. That's all.
शेवटचं कॉम्बिनेशन – CentOS आणि Apache. आता तुम्हाला पॅटर्न दिसत असेल: install, vhost, restorecon, firewalld, टेस्ट आणि reload. बस, इतकंच.
आख़िरी कॉम्बिनेशन – CentOS और Apache. अब आपको पैटर्न दिख रहा होगा: install, vhost, restorecon, firewalld, टेस्ट और reload. बस, इतना ही.
sudo service nginx stop 2>/dev/null
sudo systemctl disable nginx 2>/dev/null
sudo yum install -y httpd
sudo service httpd start
sudo systemctl enable httpd
sudo tee /etc/httpd/conf.d/mysite.conf > /dev/null <<'EOF'
<VirtualHost *:80>
ServerName mysite.local
DocumentRoot /var/www/mysite
<Directory /var/www/mysite>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorDocument 404 /404.html
ErrorLog /var/log/httpd/mysite_error.log
CustomLog /var/log/httpd/mysite_access.log combined
</VirtualHost>
EOF
sudo restorecon -Rv /var/www/mysite
if systemctl is-active --quiet firewalld; then
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --reload
fi
sudo apachectl configtest && sudo service httpd reload
curl -s http://localhost | head -5
Ravindra Bagale's Tip
Many students bring a file from the home folder into the site with mv and get 403 on CentOS – because mv keeps the old SELinux label. Use cp, or always run sudo restorecon -Rv /var/www/mysite after mv.
Ravindra Bagale's Tip – मराठी
खूप students home folder मधून mv ने file site मध्ये आणतात आणि CentOS वर 403 येतो – कारण mv जुना SELinux label ठेवून देतो. cp वापरा, किंवा mv नंतर नेहमी sudo restorecon -Rv /var/www/mysite चालवा.
Ravindra Bagale's Tip – हिंदी
बहुत students home folder से mv करके file site में लाते हैं और CentOS पर 403 आता है – क्योंकि mv पुराना SELinux label रखता है. cp इस्तेमाल करो, या mv के बाद हमेशा sudo restorecon -Rv /var/www/mysite चलाओ.
Lab
Chala, CentOS var Combination 6 kara. Mag mv ~/test.html /var/www/mysite/ ne ek navin file aana, curl -I http://localhost/test.html ne 403 bagha, aani sudo restorecon -Rv /var/www/mysite nantar parat 200 yeto ka te check kara.
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.