reverse proxy confusion

前提是你 提交于 2019-12-11 06:41:36

问题


Currently I use nginx + passenger for serving my rails app. I have been doing some research on reverse proxies and a few names pop up (squid, varnish and nginx mostly).

  1. Now If I am using nginx as my web server can I stil use it as my reverse proxy?

  2. The general sense is that most sites use nginx for proxying static content and apache/mongrel or something like that for dynamic content. If I wanna stick with my nginx, passenger setup, what would my architecture look like when I introduce a reverse proxy? Will it be a separate box or instance of nginx?

  3. What would it look like if I am introducing a load balancer like HAProxy.

  4. Finally, how important are these choices early on? So If I end up regretting a choice (let's say Varnish because it doesn't do well with cookies etc etc), is it easy to switch things around?

Thanks


回答1:


A reverse proxy is a server that sits between your actual app (rails) and the client's browser, and retrieves files on behalf of the client. What is needed to configure a reverse proxy is only to set up a server between the client and the app; since you are already using nginx you can use it as a reverse proxy also.

1 here's a link on SO: nginx be both reverse proxy and web server

2 You can set up a reverse proxy in the same instance or not. If it is a different box or process, you'll need to pass dynamic requests from one box to another.

4 I think it's fairly easy, if you are familiar with both HTTP and configuring those servers. I had a hard time with apache just because I missed a trailing slash



来源:https://stackoverflow.com/questions/3860343/reverse-proxy-confusion

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