Rocky_Linux_8
Sponsored Link

Apache httpd : Enable Userdir2021/08/03

 
Enable userdir. Users can create websites under their own home directory by this setting.
[1] Enable UserDir setting.
[root@www ~]#
vi /etc/httpd/conf.d/userdir.conf
# line 17 : comment out

#
UserDir disabled
# line 24 : uncomment

UserDir public_html
# line 32,33

<Directory "/home/*/public_html">
    AllowOverride All     # change if you need
    Options None          # change if you need
    Require method GET POST OPTIONS
</Directory>

[root@www ~]#
systemctl restart httpd

[2] If SELinux is enabled, change policy like follows.
[root@www ~]#
setsebool -P httpd_enable_homedirs on

[root@www ~]#
restorecon -R /home
[3] Create a test page with a user and access to it from any client computer with Web browser.
[rocky@www ~]$
mkdir public_html

[rocky@www ~]$
chmod 711 /home/rocky

[rocky@www ~]$
chmod 755 /home/rocky/public_html

[rocky@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>
Matched Content