2

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 have index.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 and SymLinksIfOwnerMatch
  • gaming with chmod

What else can I try? Thanks...

UPD#1: SElinux disabled

2
  • Check your error log. May 8, 2016 at 1:48
  • You should enable debug mode LogLevel debug and then check error log
    – ALex_hha
    May 8, 2016 at 11:43

2 Answers 2

-1

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:

        # getenfore

With disabled selinux mode output will be, so the problem isn't with it. Output :

         disabled

If output will be Permissive or Enforce. Just change for testing SELinux mode, verify by getenforce that it change:

       # setenforce 0
       # getenfore

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.

1
  • SElinux disabled...so that problem is not in this.
    – Phantom
    May 8, 2016 at 10:19
-1

Ah, just problem in x permissions on folders. Sorry and thanks for help!

Also, this help me too: https://askubuntu.com/questions/537032/how-to-configure-apache2-with-symbolic-links-in-var-www

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .