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

查看:100
本文介绍了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: duplicate upstream "puma" in /etc/nginx/sites-enabled/vsejalreg:1

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!

该袋或彪马如何解决许多项目无法正常工作?

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

谢谢!

推荐答案

Puma可与任何已正确配置的项目一起使用:)您只能配置一次命名上游(上游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天全站免登陆