📖 ~1 min read
Table of contents
Symptom & Impact
Apache HTTPD on CentOS Stream 10 returns 403 for files in /srv/web.
Environment & Reproduction
Hosts hosting web content outside of default /var/www tree.
cat /etc/os-release
uname -r
rpm -qa | grep
Root Cause Analysis
Custom path lacks httpd_sys_content_t SELinux context.
Quick Triage
Confirm package, network, SELinux and firewall state.
ls -Z /srv/web
ausearch -m AVC -ts recent
getenforce
Step-by-Step Diagnosis
Drill into selinux/denial state and recent journal entries to isolate the failure.
sealert -a /var/log/audit/audit.log
semanage fcontext -l | grep httpd

Solution – Primary Fix
Apply the standard remediation for selinux/denial on CentOS Stream 10.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo semanage fcontext -a -t httpd_sys_content_t '/srv/web(/.*)?'
sudo restorecon -Rv /srv/web

Solution – Alternative Approaches
Use setsebool httpd_read_user_content on if user content is hosted.
Verification & Acceptance Criteria
Validate the fix with positive functional checks before closing.
curl -I http://localhost/file
ls -Z /srv/web
Rollback Plan
Revert to the previous known-good configuration if the fix regresses.
sudo semanage fcontext -d '/srv/web(/.*)?'
sudo restorecon -Rv /srv/web
Prevention & Hardening
Codify the fix in configuration management and add monitoring.
Bake contexts into image build and use ansible sefcontext module.
Related Errors & Cross-Refs
HTTPD permission denied and port_t bindings.
Related tutorial: View the step-by-step tutorial for centos-stream-10.
View all centos-stream-10 tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
SELinux user guide.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today — we respond within one business day.