在其他端口上部署Rails应用程序

时间:2011-07-25 15:35:53

标签: ruby-on-rails passenger port virtualhost production

简单的问题,如何将我的Rails应用程序部署到我的网站的端口?我知道我可以在使用Mongrel或Webrick运行时指定端口,但这一次,我必须将其部署到生产环境中。我认为乘客可以管理这个,但我不知道如何。我试过搜索,但仍然无法找到解决方案。请帮助:)

谢谢!

随访: 我正在使用Ubuntu 10.04 LTS,我的Passenger运行Apache。

2 个答案:

答案 0 :(得分:0)

如果您正在使用Passenger with Apache或nginx。它将使用默认端口80.您可以根据您使用的Web服务器在配置文件中更改它。

答案 1 :(得分:0)

# HTTPS server
server {
  listen 80;
  listen 8080;
  server_name *.host.com;

  root /home/app/public_html/host_production/current/public;

  error_page 500 502 504 /500.html;
  location = /50x.html {
      root html;
  }
  location = /404.html {
      root html;
  }
  error_page 503 @503;
  location @503 {
    error_page 405 = /system/maintenance.html;
    if (-f $document_root/system/maintenance.html) {
      rewrite ^(.*)$ /system/maintenance.html break;
    }

    rewrite ^(.*)$ /503.html break;
  }

  try_files $uri /system/maintenance.html @passenger;


  location @passenger {
    passenger_enabled on;
    passenger_min_instances 5;
    rails_env production;
  }


  if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS)$ ){
    return 405;
  }

  if (-f $document_root/system/maintenance.html) {
    return 503;
  }


  location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ {
      gzip_static on;
      expires max;
      add_header Cache-Control public;
  }


  location ~ \.php$ {
          deny all;
  }


  access_log /dev/null;
  error_log /dev/null;
}

nginx+passenger config

相关问题