Change Document Root to /home
- June
Posted By : Admin
Change Document Root to /home
Step 1:- 
create new user in /home (With Strong Password)
create public_html folder set 755 permission from new user directory 
Step 2:- 
Change in /etc/httpd/conf/
vi httpd.conf
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
DocumentRoot “/home/test/public_html”
# Relax access to content within /var/www.
<Directory “/home/test”>
    AllowOverride None
    # Allow open access:
    Require all granted
# Further relax access to the default document root:
<Directory “/home/test/public_html”>
    # Possible values for the Options directive are “None”, “All”,
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    # Note that “MultiViews” must be named *explicitly* — “Options All”
    # doesn’t give it to you.
    # The Options directive is both complicated and important.  Please see
    # for more information.
    Options Indexes FollowSymLinks
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be “All”, “None”, or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    AllowOverride None
    # Controls who can get stuff from this server.
    Require all granted
Apache-Graceful-Restart Change Document Root to /home
Step 3:- 
Restart Apache 
systemctl restart httpd.service
Step 4:-
When Starting httpd: Syntax error on line 293 of /etc/httpd/conf/httpd.conf:
DocumentRoot ‘/home/test/public_html/’ is not a directory, or is not readable
THEN run following command 
$ chcon -R -t httpd_sys_content_t /home/test/public_html
$ chcon -R -t httpd_sys_content_t /home/test
$ chcon -R -t httpd_sys_content_t /home
Copy All your folder into /home/test/public_html

Leave a Reply