Windows 中的 Apache 虚拟主机 - 如何处理符号链接?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3034860/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:38:40  来源:igfitidea点击:

Apache Virtual Host in Windows - how do I deal with Symbolic links?

windowsapachesymlink

提问by Peeaytchpee

I'm trying to run a virtual host on a WAPPstack. My virtual host has the FollowSymLinksoption, but in Windows, all those symbolic links (I'm using shortcuts, and I think this may be the problem) have the .lnkextension. So if I'm trying to access settings.html, Apache can't find it because all i have sitting there is settings.html.lnk. Apologies if my question is unclear.

我正在尝试在WAPP堆栈上运行虚拟主机。我的虚拟主机有这个FollowSymLinks选项,但在 Windows 中,所有这些符号链接(我正在使用快捷方式,我认为这可能是问题所在)都有.lnk扩展名。因此,如果我试图访问settings.htmlApache 将无法找到它,因为我坐在那里只有settings.html.lnk. 如果我的问题不清楚,请见谅。

回答by hollandlef

Apache doesn't understand shortcuts. You need to use a proper symlink. On windows this is accomplished using the command line tool mklink. See http://ipggi.wordpress.com/2009/09/07/windows-file-junctions-symbolic-links-and-hard-links/for more details.

Apache 不理解快捷方式。您需要使用适当的符号链接。在 Windows 上,这是使用命令行工具完成的mklink。有关更多详细信息,请参阅http://ipggi.wordpress.com/2009/09/07/windows-file-junctions-symbolic-links-and-hard-links/

回答by gdoumenc

For security reasons, symlinks aren't followed by default on Apache.

出于安全原因,Apache 上默认不遵循符号链接。

Better than enable it in the config file with "Options FollowSymLinks" you should use

比在配置文件中使用“Options FollowSymLinks”启用它更好,你应该使用

http://httpd.apache.org/docs/current/urlmapping.html#outside

http://httpd.apache.org/docs/current/urlmapping.html#outside

That's not exactly the answer you expected but may help...

这不完全是您期望的答案,但可能会有所帮助......