CentOS的+阿帕奇+乘客+轨道:运行从www文件夹Rails应用 [英] Centos+Apache+passenger+rails: running rails apps from your www folder

查看:166
本文介绍了CentOS的+阿帕奇+乘客+轨道:运行从www文件夹Rails应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习Rails的,所以我是新的,想一点点帮助。

I'm trying to learn Rails, so I'm new, and would like a little help.

我试图同时运行多个应用程序,和我有一个奇怪的问题。当我尝试生成轨的东西,它给了我一个权限错误。我看了看周围计算器和其他一些网站,并没有发现什么好的解决办法。

I'm trying to run multiple apps at once, and I'm having an odd problem. When I try to generate things with rails, it gives me a permissions error. I've looked around stackoverflow and several other sites and haven't found any good solutions.

详细内容:
这种设置成功运行在这些位置的两个Rails应用:

Details: This setup successfully runs two rails apps in these locations:


  1. http://rails.mechapps.co/

  2. http://slide.mechapps.co/

  1. http://rails.mechapps.co/
  2. http://slide.mechapps.co/

2目前显示,因为失踪的控制器(2014年4月19日凌晨12:30)的误差。然而,当我浏览到该应用程序的目录,然后运行轨道生成器幻灯片视图'我得到这个错误:

2 currently shows an error because of a missing controller (4/19/2014 12:30am). However, when I navigate to that app's directory, and run 'rails generate controller slideshow view' I get this error:

$ rails generate controller slideshow create
/usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/env.rb:68:in `initialize': Permission denied @ rb_sysopen - /tmp/spring/bff8002d6fbedba8d81e3befe2342559.pid (Errno::EACCES)
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/env.rb:68:in `open'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/env.rb:68:in `open'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/env.rb:68:in `server_running?'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/run.rb:18:in `call'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/rails.rb:23:in `call'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client.rb:26:in `run'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/bin/spring:48:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `load'
from /usr/local/rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/binstub.rb:11:in `<top (required)>'
from /var/www/html/slide.mechapps.co/slide/bin/spring:16:in `require'
from /var/www/html/slide.mechapps.co/slide/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

这是我的设置:
/etc/http/conf/httpd.conf:

Here's my setup: /etc/http/conf/httpd.conf:

...
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby
</IfModule>
...
RackEnv development
<VirtualHost *:80>
    ServerName rails.mechapps.co
    DocumentRoot /var/www/html/rails.mechapps.co/blog/public
        <Directory /var/www/html/rails.mechapps.co>
                AllowOverride all
                Options -MultiViews
        </Directory>
</VirtualHost>
<VirtualHost *:80>
    ServerName slide.mechapps.co
    DocumentRoot /var/www/html/slide.mechapps.co/slide/public
        <Directory /var/www/html/slide.mechapps.co>
                AllowOverride all
                Options -MultiViews
        </Directory>
</VirtualHost>

我的根目录的权限:

My Root Directory's permissions:

drwxr-xr-x [user] [group] 4096 Apr 18 23:17 rails.mechapps.co
drwxr-xr-x [user] [group] 4096 Apr 19 04:22 slide.mechapps.co

app目录的权限:

The App Directory's permissions:

-rw-rw-r-- 1 [user] [group] 1337 Apr 19 04:22 Gemfile
-rw-rw-r-- 1 [user] [group] 2982 Apr 19 04:22 Gemfile.lock
-rw-rw-r-- 1 [user] [group]  478 Apr 19 04:22 README.rdoc
-rw-rw-r-- 1 [user] [group]  249 Apr 19 04:22 Rakefile
drwxrwxr-x 8 [user] [group] 4096 Apr 19 04:22 app
drwxr-xr-x 2 [user] [group] 4096 Apr 19 04:22 bin
drwxrwxr-x 5 [user] [group] 4096 Apr 19 04:26 config
-rw-rw-r-- 1 [user] [group]  154 Apr 19 04:22 config.ru
drwxrwxr-x 2 [user] [group] 4096 Apr 19 04:24 db
drwxrwxr-x 4 [user] [group] 4096 Apr 19 04:22 lib
drwxrwxr-x 2 [user] [group] 4096 Apr 19 04:22 log
drwxrwxr-x 2 [user] [group] 4096 Apr 19 04:22 public
drwxrwxr-x 8 [user] [group] 4096 Apr 19 04:22 test
drwxrwxr-x 3 [user] [group] 4096 Apr 19 04:22 tmp
drwxrwxr-x 3 [user] [group] 4096 Apr 19 04:22 vendor

我登录的两个地点的所有者。

I am logged in as the owner of both locations.

我怀疑存在以下问题:


  1. 运行多个Rails应用一次是混淆导轨发电机

  2. 我莫名其妙地搞砸的Ruby / Rails配置和应用程序是
    发生冲突

  3. 红宝石被安装为根,和我的用户加入到
    RVM组。也许这是一个RVM问题?

如果你知道如何解决这个问题,或者有任何想法,请帮助。我已经花了近8小时来寻找互联网和尝试各种配置。谢谢!

If you know how to fix this, or have any ideas, please help. I've spent almost 8 hours searching the internet and trying various configurations. Thanks!

推荐答案

好吧,我想通了这一点,我已经编辑了问题的标题澄清。

Ok, I figured this out, and I've edited the question title to clarify.

我的问题是,我把我的Rails应用诠释我的CentOS服务器的/ var / WWW /目录下。 Aparantly CentOS的有该文件夹不同的安全保卫措施,轨未能使其正确的修改。

My problem was, I was putting my rails apps int the /var/www/ directory of my CentOS server. Aparantly CentOS has separate security measures for that folder, and rails was unable to make it's modifications correctly.

我从www文件夹中的文件移动到/应用/ ...,并指出我的VirtualHosts那里,因为一切都一帆风顺。

I moved the files from the www folder to /apps/... and pointed my VirtualHosts there, and everything has been smooth sailing since.

另外,我意识到,你永远不希望在WWW文件夹中安装Rails应用,由于安全问题。 CentOS是设置为自动处理您的www文件夹作为向公众开放。用户可能会获得Apache来提供你的Rails应用程序文件。不好。

In addition, I realized that you never want to install rails apps in the www folder due to security issues. CentOS is set to automatically treat your www folder as open to the public. A user could probably get Apache to serve up your rails application files. Not good.

这篇关于CentOS的+阿帕奇+乘客+轨道:运行从www文件夹Rails应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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