大多数教程都展示了如何将 nginx Web 服务器配置为 unicorn ruby 应用程序服务器的代理,当它们在同一台服务器上时;结果是它们都通过 unix 套接字进行通信。如果它们在不同的服务器上,我该如何配置它们。
最佳答案
unicorn designed只为快速客户服务:
unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels. Slow clients should only be served by placing a reverse proxy capable of fully buffering both the the request and response in between unicorn and slow clients.
它如何在多节点环境之间进行负载平衡?答案是让应用程序节点 Nginx+Unicorn(通过 Unix Domain Socket 连接)和顶级 Nginx 作为单独节点上的负载均衡器。
关于ruby-on-rails - 在不同的服务器上运行 unicorn 和 nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31630717/