CentOS 6
Sponsored Link

Enable Userdir2014/08/25

 
Enable userdir, users can build websites with this config.
[1] Configure httpd to use UserDir.
[root@www ~]#
vi /etc/httpd/conf/httpd.conf
# line 366: comment out

#
UserDir disabled
# line 373: uncomment

UserDir public_html
# line 381 - 392: uncomment

<Directory /home/*/public_html>
    AllowOverride
All
   
# change

    Options
None
   
# change

    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>
[root@www ~]#
/etc/rc.d/init.d/httpd restart

[2] If SELinux is enabled, change rules to use users' home directories.
[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.
[cent@www ~]$
mkdir public_html

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

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

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