反向代理混乱 [英] reverse proxy confusion
问题描述
目前,我使用Nginx + passenger服务我的Rails应用程序.我一直在对反向代理进行一些研究,并弹出了一些名称(大多数是鱿鱼,清漆和Nginx).
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).
-
现在如果我使用nginx作为我的 网络服务器我是否可以将其用作我的服务器 反向代理?
Now If I am using nginx as my web server can I stil use it as my reverse proxy?
一般意义是 网站使用Nginx代理静态 内容和apache/杂种或 像这样的动态 内容.如果我想坚持我的 nginx,乘客设置,会怎样 我的建筑看起来像当我 引入反向代理?会吗 是一个单独的盒子或实例 nginx?
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?
如果我是什么样子 引入类似的负载均衡器 HAProxy.
What would it look like if I am introducing a load balancer like HAProxy.
最后,这些有多重要 提早选择?所以如果我结束 后悔一个选择(假设 清漆,因为效果不好 与饼干等),这很容易 换东西了吗?
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?
谢谢
推荐答案
反向代理是一台服务器,位于实际应用程序(轨道)和客户端浏览器之间,并代表客户端检索文件.配置反向代理仅需要在客户端和应用之间设置服务器.由于您已经在使用nginx,因此也可以将其用作反向代理.
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 :这是SO上的链接: nginx既是反向代理又是Web服务器
1 here's a link on SO: nginx be both reverse proxy and web server
2 您可以在同一实例中设置反向代理,也可以不在同一实例中设置.如果它是不同的盒子或流程,则需要将动态请求从一个盒子传递到另一个盒子.
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 ,如果您同时熟悉HTTP和配置这些服务器,我认为这很容易.我在Apache上遇到了困难,只是因为我错过了结尾的斜杠
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
这篇关于反向代理混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!