I googling many many info about this, but none of the proposed solutions did not help me.
What i have:
- clean
rhel7
system - clean
apache 2.4
- web dir:
/var/www/domain.com/public_html
- symlink:
/var/www/domain.com/publik_html/src
=>/home/user/src
- in
/home/user/src
i haveindex.html
with some text
My apache VH configuration (/etc/httpd/sites-available/domain.com.conf
):
<VirtualHost *:80>
ServerName www.domain.com
ServerAlias domain.com
DocumentRoot /var/www/domain.com/public_html
<Directory /var/www/domain.com/public_html>
Options Indexes FollowSymLinks
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
Some interested sections in apache main config:
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
#
# 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 "/var/www/html"
#
# Relax access to content within /var/www.
#
<Directory "/var/www">
Options Indexes FollowSymLinks
AllowOverride None
# Allow open access:
Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/var/www/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
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# 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>
Problem: when i try access to domain.com/src/index.html
i get Forbidden.
What i try:
chmod o+x /home /home/user /home/user/src /home/user/src/index.html
chown -R apache:apache /var/www/
chown -R apache:apache /home/user/src/
- gaming with
FollowSymLinks
andSymLinksIfOwnerMatch
- gaming with
chmod
What else can I try? Thanks…
UPD#1: SElinux disabled
Best Answer
If you use rhel7 based system (centos,fedora etc.) you have SElinux enabled by default. At my practice 95 % of problem is selinux configuration mismatch, i think that your apache configuration correct. Please execute with root privileges:
With disabled selinux mode output will be, so the problem isn't with it. Output :
If output will be Permissive or Enforce. Just change for testing SELinux mode, verify by getenforce that it change:
Try one more http query with your apache server (Try to load page with your browser and address example.com). If this solution will help wrote here. All solution wrote at the top only for finding where problem is, don't work at production server with this changes. Please don't disable SELinux as it do many administrator, it is unsafe. I will wrote second part of command for enable SELinux permission after you wrote if first part take effect.