相关疑难解决方法(0)

nginx和unicorn上的多个rails应用程序

我使用Screencast 335部署到VPS教程成功设置了rails站点.现在我想在新域上添加另一个rails应用程序,但我对所需的步骤感到困惑.

在上面的设置中,site-available或/etc/nginx/nginx.conf没有变化.唯一的配置是在我的apps配置目录中的unicorn.rb,unicorn_init.sh和nginx.conf中.nginx.conf文件如下所示: -

upstream unicorn {
  server unix:/tmp/unicorn.my_app.sock fail_timeout=0;
}
server {
  listen 80 default deferred;
  # server_name my_app.com.au www.my_app.com.au;
  root /var/www/my_app/current/public;
  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }
  try_files $uri/index.html $uri @unicorn;
  location @unicorn {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://unicorn;
  }
  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;
}
Run Code Online (Sandbox Code Playgroud)

在我的Capistrano配方中,我有这条线

sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
Run Code Online (Sandbox Code Playgroud)

添加第二个域只是在监听和取消注释server_name部分之后删除默认延迟,然后使用不同的上游套接字名称和第二个应用程序的服务器名称重复此配置文件?这样做还是我需要将此文件传输到可用的站点并创建启用站点的符号链接?

ubuntu ruby-on-rails nginx unicorn

10
推荐指数
2
解决办法
9795
查看次数

标签 统计

nginx ×1

ruby-on-rails ×1

ubuntu ×1

unicorn ×1