rails nginx puma 复制上游"puma"在/etc/nginx/sites-enabled [英] rails nginx puma duplicate upstream "puma" in /etc/nginx/sites-enabled

查看:53
本文介绍了rails nginx puma 复制上游"puma"在/etc/nginx/sites-enabled的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为本教程设置了我的服务器(https://coderwall.com/p/ttrhow/deploying-rails-app-using-nginx-puma-and-capistrano-3)

I've set up my server for this tutorial (https://coderwall.com/p/ttrhow/deploying-rails-app-using-nginx-puma-and-capistrano-3)

当我使用一个项目时,一切正常,但是当我将另一个项目添加到此 VPS 时,出现错误[emerg] 20737#0:在/etc/nginx/sites-enabled/vsejalreg:1 中重复上游puma"

When I used one project, all works, but when I added another project to this VPS, I have error [emerg] 20737#0: duplicate upstream "puma" in /etc/nginx/sites-enabled/vsejalreg:1

我的nginx配置

upstream puma {
  server unix:///home/deployer/apps/vsejalreg/shared/tmp/sockets/vsejalreg-puma.sock;
}

server {
  listen 80;
  server_name wjreg.rubyserv.ru www.wjreg.rubyserv.ru;

  root /home/deployer/apps/vsejalreg/current/public;
  access_log /home/deployer/apps/vsejalreg/current/log/nginx.access.log;
  error_log /home/deployer/apps/vsejalreg/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 10;
}

upstream puma {
  server unix:///home/deployer/apps/register/shared/tmp/sockets/register-puma.sock;
}

server {
  listen 80;
  server_name ws.rubyserv.ru www.ws.rubyserv.ru;

  root /home/deployer/apps/register/current/public;
  access_log /home/deployer/apps/register/current/log/nginx.access.log;
  error_log /home/deployer/apps/register/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 10;
}

当我一一添加 nginx 配置时 - 一切正常!

When I add nginx configure one by one - all work!

如何解决这个包或 puma 不适用于许多项目?

How fix this bag or puma not working with many project?

谢谢!

推荐答案

Puma 适用于任何正确配置的项目 :) 您可以只配置命名上游(upstream puma)一次,而不是每个服务器配置.如果每个服务器需要不同的 puma 实例,只需设置不同名称的上游即可.

Puma works with any proper configured project :) You can configure named upstream (upstream puma) just once, not with every server configuration. If you need different puma instances for each server, just setup upstreams with different names.

upstream puma_vsejalreg {
  server unix://...PATH.../vsejalreg-puma.sock;
}
upstream puma_register {
  server unix://...PATH.../register-puma.sock;
}

这篇关于rails nginx puma 复制上游"puma"在/etc/nginx/sites-enabled的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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