Hostxpeed
Login Get Started →
Security

How to Set Up SELinux

5 min read
30 views
Jun 10, 2026

Step 1: Check SELinux Status

sestatus
getenforce

Step 2: Enable SELinux

sudo nano /etc/selinux/config

Set:

SELINUX=enforcing
SELINUXTYPE=targeted

Step 3: Apply Changes (Reboot Required)

sudo reboot

Step 4: Manage Booleans

sudo setsebool -P httpd_can_network_connect on

Step 5: Set File Contexts

sudo semanage fcontext -a -t httpd_sys_content_t "/var/www/myapp(/.*)?"
sudo restorecon -Rv /var/www/myapp

Was this article helpful?