Fedora 29
Sponsored Link

Apache httpd : Enable UserDir2018/11/10

 
Enable userdir, users can create websites with this setting.
[1] Configure httpd.
[root@www ~]#
vi /etc/httpd/conf.d/userdir.conf
# line 17: comment out

#
UserDir disabled
# line 24: uncomment

UserDir public_html
# line 31-35

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

[root@www ~]#
systemctl restart httpd

[2] If SELinux is enabled and also enable CGI except default location like above, add rules like follows.
[root@www ~]#
dnf -y install checkpolicy policycoreutils-python-utils
[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 client PC with web browser. It's OK if following page is shown.
[fedora@www ~]$
mkdir public_html

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

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

[fedora@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