使用Passenger和Apache在vps上部署我的rails应用程序

时间:2017-03-14 09:51:29

标签: ruby-on-rails ruby apache deployment passenger

我在使用Passenger部署我的rails应用程序时遵循了此演练(https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/el6/deploy_app.html),但当我尝试在浏览器上访问IP地址时,出现“无法访问此站点”错误。我使用Nginx遇到了同样的问题,我切换到Apache但我仍然遇到同样的问题。这是我的第一次部署,我现在真的很困惑。任何帮助将不胜感激。这是我的/etc/httpd/conf.d/cfkmv.conf,如果它有帮助

<VirtualHost *:80>
    ServerName 144.217.160.59
     # Tell Apache and Passenger where your app's 'public' directory is
     DocumentRoot /var/www/my_fast_cash/code/public

     PassengerRuby /usr/local/rvm/gems/ruby-2.3.1/wrappers/ruby

     # Relax Apache security settings
     <Directory /var/www/my_fast_cash/code/public>
         Allow from all
         Options -MultiViews
         # Uncomment this if you're on Apache >= 2.4:
         #Require all granted
      </Directory>
</VirtualHost>

1 个答案:

答案 0 :(得分:0)

安装乘客并在.conf文件中添加乘客模块

安装乘客的命令:

sudo apt-get install libapache2-mod-passenger

安装后,他们提供模块安装代码,然后将其添加到服务器conf文件下,然后重新启动它。

代码是这样的:

 LoadModule passenger_module /usr/local/rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.59
     PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.8.7-p374/wrappers/ruby
   </IfModule>