rails nginx puma duplicate upstream “puma” in /etc/nginx/sites-enabled

霸气de小男生 提交于 2019-12-05 18:56:22

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;
}

Please note, that you need to change this part aswell:

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;
  }

Else you will run into errors such as this - nginx: [emerg] host not found in upstream "puma" in /etc/nginx/sites-enabled/furnitureapp:25

So, if you rename your upstream to

upstream puma_register

You need to rename your proxy_pass as well to

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_register; <------ Change here
  }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!