将ruby从1.8.7升级到1.9.3会导致服务器崩溃

时间:2013-03-04 13:35:24

标签: ruby-on-rails ruby apache passenger

我的rails 3.2.8应用程序正在使用ruby1.8.7并且运行正常。最近,我将ruby版本升级为1.9.3,导致服务器崩溃。我更新了所有宝石以与ruby的最新版本兼容。但从那以后,apache没有运行我的应用程序。如果我运行rails webrick server,则可以使用IP地址和端口访问站点。但是使用域名无法访问它,因为Apache的配置似乎不正确。之前很好,我没有改变它或什么。我刚刚升级了Ruby。任何人都知道我在这里缺少什么?请帮忙。

apache配置文件如下。

apache2.conf

LockFile ${APACHE_LOCK_DIR}/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
<IfModule mpm_prefork_module>
  StartServers          5
  MinSpareServers       5
  MaxSpareServers      10
  MaxClients          150
  MaxRequestsPerChild   0
</IfModule>
<IfModule mpm_worker_module>
  StartServers          2
  MinSpareThreads      25
  MaxSpareThreads      75 
  ThreadLimit          64
  ThreadsPerChild      25
  MaxClients          150
  MaxRequestsPerChild   0
</IfModule>
<IfModule mpm_event_module>
  StartServers          2
  MinSpareThreads      25
  MaxSpareThreads      75 
  ThreadLimit          64
  ThreadsPerChild      25
  MaxClients          150
  MaxRequestsPerChild   0
</IfModule>
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
<Files ~ "^\.ht">
  Order allow,deny
  Deny from all
  Satisfy all
</Files>
DefaultType None
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
Include mods-enabled/*.load
Include mods-enabled/*.conf
Include httpd.conf
Include ports.conf
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r..

test.myapplication.com

<VirtualHost *:80>

  ServerName test.myapplication.com

  ServerAlias XX.XX.XX.X/mytest

  DocumentRoot /home/XXXX/public_html/public 

  ErrorLog /var/log/apache2/XXXXX_errors.log

  LogLevel warn

  CustomLog /var/log/apache2/XXXXX_access.log combined

  SetEnv RAILS_ENV production

  <Directory /home/XXXXX/public_html/public>

    Allow from all

    Options -MultiViews

  </Directory>

</VirtualHost>

1 个答案:

答案 0 :(得分:1)

我猜你需要更新apache配置才能使用新的ruby。

所以在你的apache conf中你应该有这样的东西:

LoadModule passenger_module /usr/lib/ruby/gems/1.9.2@rails3/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.9.2/gems/passenger-3.0.2
PassengerRuby /usr/bin/ruby1.9.2

你应该只需要修复路径..