Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Options FollowSymLinks or SymLinksIfOwnerMatch is off

I've read almost everything possible for this issue and couldn't find anything that would solve my problem. This is erorr log I'm getting: Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/vhosts/site.com/httpdocs/cgi-bin/cron.pl

When accessing site I get 403 Forbidden "You do not have permission to access this document." error.

I've modified my .htaccess to have this:

Options +FollowSymLinks +SymLinksIfOwnerMatch AddDefaultCharset utf-8 RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^(.*) - [E=HTTP_CGI_AUTHORIZATION:%1] . . . 

I also added this to httpd.conf:

AddHandler cgi-script .cgi AddHandler cgi-script .pl  <Directory /> Options -ExecCGI FollowSymLinks -Includes -IncludesNOEXEC -Indexes -MultiViews -SymLinksIfOwnerMatch AllowOverride All </Directory> 

Really what can I do next?

like image 232
user1590251 Avatar asked Aug 10 '12 12:08

user1590251


People also ask

What is Options +FollowSymLinks?

Parameter Options FollowSymLinks enables you to have a symlink in your webroot pointing to some other file/dir. With this disabled, Apache will refuse to follow such symlink. More secure Options SymLinksIfOwnerMatch can be used instead - this will allow you to link only to other files which you do own.

What is SymLinksIfOwnerMatch?

The server will only follow symbolic links for which the target file or directory is owned by the same user id as the link.


2 Answers

Watch that the directory where your web application is living, is not included in another parent directory which has restricted FollowSymLinks.

The solution is to enable FollowSymLinks at the top directory (parent directory) or move your web application to a directory outside of the scope of the "no FollowSymLinks" in parent directory.

For example, the next apache config could be a problem and surely it reproduces the problem:

    <VirtualHost *:80>       ...         <Directory "D:/">         Options Indexes       </Directory>        <Directory "D:/mywebfolder/">         Options Indexes FollowSymLinks       </Directory>       ...    </VirtualHost> 

To avoid this problem:

    <VirtualHost *:80>       ...         <Directory "D:/">         Options Indexes FollowSymLinks       </Directory>       ...       ...    </VirtualHost> 

Or move your D:/mywebfolder/ to another unit e.g. E:/mywebfolder

like image 110
Hokusai Avatar answered Sep 22 '22 19:09

Hokusai


Note this from the apache docs for option:

Mixing Options with a + or - with those without is not valid syntax, and will be rejected during server startup by the syntax check with an abort.

You are mixing options with +/- and without in your block (i.e. see FollowSymLinks).

I had this same exact error showing up today on one of my sites where I had forgotten to add a "+" in front of an option. I added the "+" and it now works.

like image 31
user12345 Avatar answered Sep 21 '22 19:09

user12345