Options FollowSymLinks or SymLinksIfOwnerMatch is off

老子叫甜甜 提交于 2019-11-30 07:56:45
Hokusai

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

user12345

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.

I had this issue and finally found that because I had php configured with fast-cgi rather than as an apache module, I had to update the \conf\extra\httpd-fcgid.conf and then added FollowSymLinksto this block

<Files ~ "\.php$">
Options ExecCGI FollowSymLinks
AddHandler fcgid-script .php
FcgidWrapper "d:/php/php-cgi.exe" .php
</Files>

Hope this helps someone and saves the hours I wasted.

I recently had a similar error and I fixed it for me. One possible root cause for this problem is that the target folder (to which the rewrite is made), mentioned in the error text itself, does not have FollowSymLinks option set. From your error message, I see this folder is: /var/www/vhosts/site.com/httpdocs/cgi-bin/

In this case, you can use in .htaccess of that specific folder:

Options +FollowSymLinks

This setting above will just add the FollowSymLinks for this folder on top of the existing options (that's what + stands for. it only adds this option).

Example:

<IfModule mod_rewrite.c>
  RewriteEngine On
  Options +FollowSymLinks
</IfModule>

This was the case where I had the error and this was how I fixed it. In my case, there was a different folder (not cgi-bin) and different file (a PHP file).

Warning:

  • Make sure you really want to rewrite URL to point to cgi-bin. If you have important scripts here, it may impact security and you may not want this rewrite to happen. If you make this setting in cgi-bin, people would be able to view output of your scripts in cgi-bin, which might not be good unless you know what you are doing.

Notes:

  • Please note that depending on local settings / browser settings, updating the .htaccess may not provide the effect in the browser instantly, when you type in the URL, and may display the same result right away, without considering your modifications to .htaccess. In this case you might have to restart the browser to see the effect of your modifications. For beginners this can be very time consuming when trying to fix, and confusing on why it won't work. Also, if you modify httpd.conf (not the case in my post), you have to restart the web server.

  • While investigating for fix to my error, I noticed on web that this error has also hapened for some people, for a Plesk installation, in which case the solution to that specific problem was to edit /etc/apache2/mods-enabled/dir.conf, and update DirectoryIndex, and move index.php before index.pl.

Put this in your root directory:

<Directory />
    #AllowOverride none
    Require all denied
    Options FollowSymLinks
    Options SymLinksIfOwnerMatch 
</Directory>

<Directory "root">
    Options FollowSymLinks
    Options SymLinksIfOwnerMatch 
</Directory>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!