Linux 什么是选项 +FollowSymLinks?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12120035/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is Options +FollowSymLinks?
提问by ytsejam
I am using a Lamp server on my computer. I started to use Laravel php framework.
In my .htaccess , If I use Options +FollowSymLinks
, I get 500 error.
And If I comment out , I have to use index.php
in my all addresses ..example:
我在我的电脑上使用 Lamp 服务器。我开始使用 Laravel php 框架。在我的 .htaccess 中,如果我使用Options +FollowSymLinks
,我会收到 500 错误。如果我注释掉,我必须index.php
在我的所有地址中使用 ..example:
/~ytsejam/blog/public/index.php/login
I use Arch Linux . Is there a way to solve it?
我使用 Arch Linux 。有办法解决吗?
edit: I solved this by using virtual hosts. And deleting index.php from application/config/application.php
in laravel folder.
编辑:我通过使用虚拟主机解决了这个问题。并index.php from application/config/application.php
在 Laravel 文件夹中删除。
回答by Hendrik Jan
You might try searching the internet for ".htaccess Options not allowed here".
您可以尝试在 Internet 上搜索“此处不允许使用 .htaccess 选项”。
A suggestion I found (using google) is:
我发现的一个建议(使用谷歌)是:
Check to make sure that your httpd.conf file has AllowOverride All.
检查以确保您的 httpd.conf 文件具有 AllowOverride All。
A .htaccess file that works for me on Mint Linux (placed in the Laravel /public folder):
在 Mint Linux 上对我有用的 .htaccess 文件(放置在 Laravel /public 文件夹中):
# Apache configuration file
# http://httpd.apache.org/docs/2.2/mod/quickreference.html
# Turning on the rewrite engine is necessary for the following rules and
# features. "+FollowSymLinks" must be enabled for this to work symbolically.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L]
</IfModule>
Hope this helps you. Otherwise you could ask a question on the Laravel forum (http://forums.laravel.com/), there are some really helpful people hanging around there.
希望这对你有帮助。否则你可以在 Laravel 论坛 (http://forums.laravel.com/) 上提问,那里有一些非常有帮助的人。
回答by Albuquerque Web Design
How does the server know that it should pull image.png from the /pictures folder when you visit the website and browse to the /system/files/images folder in your web browser? A so-called symbolic link is the guy that is responsible for this behavior. Somewhere in your system, there is a symlink that tells your server "If a visitor requests /system/files/images/image.png then show him /pictures/image.png."
当您访问网站并浏览到 Web 浏览器中的 /system/files/images 文件夹时,服务器如何知道它应该从 /pictures 文件夹中提取 image.png ?所谓的符号链接就是对这种行为负责的人。在您系统的某个地方,有一个符号链接告诉您的服务器“如果访问者请求 /system/files/images/image.png 然后向他显示 /pictures/image.png。”
And what is the role of the FollowSymLinks setting in this?
而FollowSymLinks 设置在其中的作用是什么?
FollowSymLinks relates to server security. When dealing with web servers, you can't just leave things undefined. You have to tell who has access to what. The FollowSymLinks setting tells your server whether it should or should not follow symlinks. In other words, if FollowSymLinks was disabled in our case, browsing to the /system/files/images/image.png file would return depending on other settings either the 403 (access forbidden) or 404 (not found) error.
FollowSymLinks 与服务器安全有关。在处理 Web 服务器时,您不能只保留未定义的内容。你必须告诉谁可以访问什么。FollowSymLinks 设置告诉您的服务器它是否应该遵循符号链接。换句话说,如果在我们的例子中禁用了 FollowSymLinks,浏览到 /system/files/images/image.png 文件将根据其他设置返回 403(禁止访问)或 404(未找到)错误。
回答by Marki555
Parameter Options FollowSymLinks
enables you to have a symlinkin 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.
参数Options FollowSymLinks
使您可以在 webroot 中有一个指向其他文件/目录的符号链接。禁用此功能后,Apache 将拒绝遵循此类符号链接。Options SymLinksIfOwnerMatch
可以使用更安全的方式 - 这将允许您仅链接到您拥有的其他文件。
If you use Options
directive in .htaccess
with parameter which has been forbidden in main Apache config, server will return HTTP 500 error code.
如果在主 Apache 配置Options
中.htaccess
使用已被禁止的参数中的指令,服务器将返回 HTTP 500 错误代码。
Allowed .htaccess
options are defined by directive AllowOverride
in the main Apache config file. To allow symlinks, this directive need to be set to All
or Options
.
允许的.htaccess
选项由AllowOverride
主 Apache 配置文件中的指令定义。要允许符号链接,该指令需要设置为All
or Options
。
Besides allowing use of symlinks, this directive is also needed to enable mod_rewritein .htaccess
context. But for this, also the more secure SymLinksIfOwnerMatch
option can be used.
除了允许使用符号链接外,还需要此指令来在上下文中启用mod_rewrite.htaccess
。但为此,也SymLinksIfOwnerMatch
可以使用更安全的选项。