Enable userdir to allow users to create websites under their own home directory.
Edit the UserDir configuration file to enable the feature.
# Edit UserDir configuration
[root@www ~]# vi /etc/httpd/conf.d/userdir.conf
# Line 17: Comment out
#UserDir disabled
# Line 24: Uncomment
UserDir public_html
# Lines 32, 33: Configure directory settings
<Directory "/home/*/public_html">
AllowOverride All # Change if needed
Options None # Change if needed
Require method GET POST OPTIONS
</Directory>
# Reload httpd to apply changes
[root@www ~]# systemctl reload httpd
If SELinux is enabled, modify the policy to allow HTTPD access to home directories.
# Set SELinux boolean for httpd
[root@www ~]# setsebool -P httpd_enable_homedirs on
# Restore SELinux contexts
[root@www ~]# restorecon -R /home
Create a test page as a user and access it from a web browser.
# Create a public_html directory and set permissions
[cent@www ~]$ mkdir public_html
[cent@www ~]$ chmod 711 /home/cent
[cent@www ~]$ chmod 755 /home/cent/public_html
# Create a test HTML page
[cent@www ~]$ vi ./public_html/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
UserDir Test Page
</div>
</body>
</html>
After setting up the Userdir, you can test it by accessing it from a web browser.
http://[domain]/~cent/Replace [domain] with your server's domain name or IP address.