Phusion Passenger Sub URI 符号链接问题

发布于 2024-11-02 13:46:34 字数 1287 浏览 2 评论 0原文

我正在 Ubuntu 上使用 Apache 和 Phusion Passenger 部署一个子 URI Rails 应用程序,但

www.mydomain.com/suburi 

在配置它时遇到了问题。现在我收到此错误:

Passenger Error #2
An error occurred while trying to access '/srv/www/mydomain/public/suburi': Cannot resolve possible symlink '/srv/www/mydomain/public/suburi': No such file or directory (2)

mydomain.com 的 Rails 应用程序和 mydomain.com/suburi 的 Rails 应用程序都驻留在 /srv/www/

我当前的虚拟主机如下所示:

<VirtualHost 173.230.137.212:80> 
  ServerName www.mydomain.com
  ServerAlias mydomain.com
  DocumentRoot /srv/www/mydomain/public
  ErrorLog /srv/www/error.log
  RewriteEngine On
  RewriteOptions Inherit
  RailsEnv production

<directory /srv/www/mydomain/public>
  Options Indexes FollowSymLinks -MultiViews
  AllowOverride all
  Order allow,deny 
  allow from all
</directory>

RailsBaseURI /suburi                   
<Directory /srv/www/suburi>
  Options -MultiViews               
</Directory>

我知道路径是正确的,但这是我唯一知道是正确的。我的服务器管理技能并不惊人。

我创建了从 mydomain.com 的公共文件夹到子 uri 的公共文件夹的符号链接。不确定我是否做对了,我发现文档不是那么好。我有什么遗漏和/或做错了什么吗?我是否创建了错误的系统链接?

我真的很感激一些帮助。

或者就此而言,如果有人知道更好/更简单的方法来使用子域(例如 subdomain.mywebsite.com)也可以。

谢谢

I am deploying a sub URI rails app on Ubuntu with Apache and Phusion Passenger to

www.mydomain.com/suburi 

and am having issues with getting it configured. Right now I am getting this error:

Passenger Error #2
An error occurred while trying to access '/srv/www/mydomain/public/suburi': Cannot resolve possible symlink '/srv/www/mydomain/public/suburi': No such file or directory (2)

Both the rails app for mydomain.com and the rails app for mydomain.com/suburi reside in /srv/www/

My current virtual Host looks like this:

<VirtualHost 173.230.137.212:80> 
  ServerName www.mydomain.com
  ServerAlias mydomain.com
  DocumentRoot /srv/www/mydomain/public
  ErrorLog /srv/www/error.log
  RewriteEngine On
  RewriteOptions Inherit
  RailsEnv production

<directory /srv/www/mydomain/public>
  Options Indexes FollowSymLinks -MultiViews
  AllowOverride all
  Order allow,deny 
  allow from all
</directory>

RailsBaseURI /suburi                   
<Directory /srv/www/suburi>
  Options -MultiViews               
</Directory>

I know the paths are correct, but that's the only thing I know is correct. My server administration skills are not amazing.

I made a sym link from the mydomain.com's public folder to the sub uri's public folder. Not sure if I did this right, I found the documentation to not be so great. Is there anything I'm missing and/or doing wrong? Did I make the wrong system link?

I would really appreciate some help.

Or for that matter, if anyone knows a better/easier way to do it with a sub domain, like subdomain.mywebsite.com that would work too.

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离鸿 2024-11-09 13:46:34

如果您使用 suburi-s,则

  1. / 意味着指向 Rails 应用程序的公共目录,
  2. 您的 Rails 应用程序根目录意味着是 Rails 之上的一个目录app public

如果你有一个专门的公共文档根目录为你的域,那么这两个问题都可以解决,然后你做的

ln -sf /path/to/suburi-rails-app/public <documentroot>/<suburi>

文档确实不是那么好。所以你的解决方案是:

ln -sf /srv/www/suburi/public srv/www/mydomain/public/suburi

vhost conf:

<VirtualHost 173.230.137.212:80> 

  ServerName www.mydomain.com
  ServerAlias mydomain.com
  DocumentRoot /srv/www/mydomain/public
  ErrorLog /srv/www/error.log
  RewriteEngine On
  RewriteOptions Inherit
  RailsEnv production

  <Directory /srv/www/mydomain/public>
    Options FollowSymLinks -MultiViews
    AllowOverride all
    Order allow,deny 
    Allow from all
  </Directory>

  RailsBaseURI /suburi                   
  <Directory /srv/www/mydomain/public/suburi>
    Options -MultiViews               
  </Directory>

</VirtualHost> 

你说: mydomain.com 的 Rails 应用程序和 mydomain.com/suburi 的 Rails 应用程序都驻留在 /srv/www/

这让我有点困惑,我不知道我认为在一个域上运行一个应用程序,在一个 suburi 上运行另一个应用程序是个好主意,因为路由肯定会很混乱。
而是使用 2 个 suburi-s,在这种情况下,执行

ln -sf /srv/www/suburi2/public srv/www/mydomain/public/suburi2

/srv/www/suburi2 是您的第二个应用程序根目录的操作,并添加:

RailsBaseURI /suburi2                   
<Directory /srv/www/mydomain/public/suburi2>
  Options -MultiViews               
</Directory>

您可以将任意数量的 suburi 添加到同一虚拟主机。

希望这有帮助

If you use suburi-s, then

  1. <documentroot>/<suburi> is meant to point to the public dir of your rails app
  2. your rails app root dir is meant to be one directory above your rails app public

Both are solved if you got a dedicated public docroot for your domain, and then you do

ln -sf /path/to/suburi-rails-app/public <documentroot>/<suburi>

The documentation is indeed not so great. So your solution would be:

ln -sf /srv/www/suburi/public srv/www/mydomain/public/suburi

and the vhost conf:

<VirtualHost 173.230.137.212:80> 

  ServerName www.mydomain.com
  ServerAlias mydomain.com
  DocumentRoot /srv/www/mydomain/public
  ErrorLog /srv/www/error.log
  RewriteEngine On
  RewriteOptions Inherit
  RailsEnv production

  <Directory /srv/www/mydomain/public>
    Options FollowSymLinks -MultiViews
    AllowOverride all
    Order allow,deny 
    Allow from all
  </Directory>

  RailsBaseURI /suburi                   
  <Directory /srv/www/mydomain/public/suburi>
    Options -MultiViews               
  </Directory>

</VirtualHost> 

you say that: Both the rails app for mydomain.com and the rails app for mydomain.com/suburi reside in /srv/www/

This confused me a bit, I don't think it is a good idea to want to run an app on a domain and another on a suburi, since routing is bound to be confused.
Rather use 2 suburi-s, in which case do

ln -sf /srv/www/suburi2/public srv/www/mydomain/public/suburi2

where /srv/www/suburi2 is your second applications root dir, and add:

RailsBaseURI /suburi2                   
<Directory /srv/www/mydomain/public/suburi2>
  Options -MultiViews               
</Directory>

you can add any number of suburis to the same vhost.

hope this helped

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文