我的/public目录是否可以是rails 3 + passenger 3 + nginx 0.8的符号链接? [英] Can my /public directory be a symlink with rails 3 + passenger 3 + nginx 0.8?

查看:50
本文介绍了我的/public目录是否可以是rails 3 + passenger 3 + nginx 0.8的符号链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在整理Rails部署,其中公共目录是 符号链接到系统上的另一个目录.这是乘客3 nginx .8.它似乎不喜欢该设置.默认情况下,Nginx始终遵循符号链接,因此AFAIK不必等效于Apache的+ FollowSymLinks.

I'm putting together a rails deployment where the public directory is a symlink to another directory on the system. This is with passenger 3 on nginx .8. It does't seem to like that setup. Nginx always follows symlinks by default, so AFAIK it's not a matter of doing the equivalent of Apache's +FollowSymLinks.

更新

此处涵盖了类似的内容: http://www.modrails .com/documentation/Users%20guide%20Nginx.html#application_detection

Looks like this is covered here: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#application_detection

请注意,Nginx的Phusion乘客 无法解决 根路径.例如,假设 你的根指向 /home/www/example.com,依次 是与之的符号链接 /webapps/example.com/public.错觉 Nginx的乘客将检查 /home/www/config/environment.rb,而不是 /webapps/example.com/config/environment.rb. 该文件当然不存在,并且 结果,Phusion乘客将不会 为此虚拟主机激活自己, 然后您很可能会看到一些输出 由Nginx默认生成 目录处理程序,例如禁止" 错误消息.

Note that Phusion Passenger for Nginx does not resolve any symlinks in the root path. So for example, suppose that your root points to /home/www/example.com, which in turn is a symlink to /webapps/example.com/public. Phusion Passenger for Nginx will check for /home/www/config/environment.rb, not /webapps/example.com/config/environment.rb. This file of course doesn’t exist, and as a result Phusion Passenger will not activate itself for this virtual host, and you’ll most likely see some output generated by the Nginx default directory handler such as a Forbidden error message.

检测机架应用程序发生 通过相同的机制,例外 Phusion乘客会寻找的 config.ru而不是 config/environment.rb.

Detection of Rack applications happens through the same mechanism, exception that Phusion Passenger will look for config.ru instead of config/environment.rb.

所以我想知道config.ru的正确符号链接是否可以解决问题.

So I wonder if some proper symlinking of config.ru might do the trick.

推荐答案

我认为无法使用符号链接的公共目录.我能想象的唯一解决方法是在公共目录内符号链接任何文件和目录.

I think it is not possible to use a symlinked public directory. The only workaround I can imagine is to symlink any file and directory inside of the public dir.

# public folder: /data/public
# app folder: /webapp/
mkdir -p /webapp/public && ln -sf /data/public/* /webapp/public/

对于/data/public中的每个新文件或目录,您都必须再次运行此命令.

For every new file or directory in /data/public you have to run this command again.

这篇关于我的/public目录是否可以是rails 3 + passenger 3 + nginx 0.8的符号链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆