linux-2

Change Document Root to /home

The-Smallest-Server-Suite
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
</Directory>
 
# 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
</Directory>
 Apache-Graceful-Restart
Step 3:- 
 
Restart Apache 
 
systemctl restart httpd.service
 
Step 4:-
 
if ERROR LIKE 
 
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
 
OR FORBIDDEN 
 
THEN run following command 
 
RUN AS ROOT 
 
$ 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

Your email address will not be published. Required fields are marked *