📖 ~1 min read
Table of contents
Symptom & Impact
Service bound to non-standard port fails to start under SELinux enforcing.
Environment & Reproduction
Custom microservices on CentOS Stream 9 using non-default ports.
cat /etc/os-release
uname -r
rpm -qa | grep
Root Cause Analysis
Port not labelled with appropriate type (e.g. http_port_t).
Quick Triage
Confirm package, network, SELinux and firewall state.
ss -tlnp
semanage port -l | head
ausearch -m AVC -ts recent
Step-by-Step Diagnosis
Drill into selinux/port state and recent journal entries to isolate the failure.
sealert -a /var/log/audit/audit.log

Solution – Primary Fix
Apply the standard remediation for selinux/port on CentOS Stream 9.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo semanage port -a -t http_port_t -p tcp 8081
sudo systemctl restart httpd

Solution – Alternative Approaches
Use existing labelled ports where possible to reduce policy drift.
Verification & Acceptance Criteria
Validate the fix with positive functional checks before closing.
ss -tlnp | grep 8081
curl -I http://localhost:8081
Rollback Plan
Revert to the previous known-good configuration if the fix regresses.
sudo semanage port -d -t http_port_t -p tcp 8081
Prevention & Hardening
Codify the fix in configuration management and add monitoring.
Define ports in Ansible seport module.
Related Errors & Cross-Refs
Firewalld vs SELinux port mismatch.
Related tutorial: View the step-by-step tutorial for centos-stream-9.
View all centos-stream-9 tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
SELinux ports reference.
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.