403 forbidden after change DocumentRoot in Apache 2.4

asked 2015-12-09 07:31:14 -0500

Migamipe gravatar image

Good morning. I installed Fedora Workstation 23 yesterday and install LAMP without problems. But, after change the DocumentRoot in httpd.conf file when i want access to localhost i got an 403. So, I search and find some similar cases but didn't help me. This is all i've done:

  1. Change DocumentRoot to /home/<user>/www
  2. Add permissions for override access: AllowOverride Require all granted.
  3. I found in a forum that the problem could be by VirtualHosts, so i added a VirtualHost pointed to the DocumentRoot and with the same permissions (see the httpd.conf).
  4. I set SELinux restriction to my DocumentRoot: chcon -R -t httpd_sys_content_t www
  5. I edit the userdir.conf file for allow UserDir (see userdir.conf)
  6. Set chmod 775 to DocumentRoot.

userdir.conf

<IfModule mod_userdir.c>
    #UserDir disabled
    UserDir public_html
</IfModule>
<Directory "/home/migamipe/www/public_html">
    #AllowOverride FileInfo AuthConfig Limit Indexes
    #Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    #Require method GET POST OPTIONS
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

httpd.conf

#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see 
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so 'log/access_log'
# with ServerRoot set to '/www' will be interpreted by the
# server as '/www/log/access_log', where as '/log/access_log' will be
# interpreted as '/log/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/etc/httpd"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those ...
(more)
edit retag flag offensive close merge delete

Comments

Think you mush set user home folder to 711 in you case sudo chmod 711 /home/migamipe also notice your root should be /home/migamipe/public_html not /home/migamipe/www/public_html for it to work as set on mod_user section

aeperezt gravatar imageaeperezt ( 2015-12-09 08:50:01 -0500 )edit

Does running setenforce 0 (without reboot) solve the problem?

hedayat gravatar imagehedayat ( 2015-12-09 13:58:01 -0500 )edit

Thanks guys. I set the old DocumentRoot (var/html) and use /home/migamipe/www for virtual hosts. I added 755 permisions to mi home dir and done. Greetings.

Migamipe gravatar imageMigamipe ( 2015-12-09 16:39:01 -0500 )edit