反向代理的基础知识

反向代理的基础知识

本文介绍了反向代理的基础知识?我错过了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是服务器管理员,只是一个尝试充当服务器管理员的网络开发人员.:)

I am no server admin, just a web developer trying to act as such. :)

我们有网站 A 和网站 B.网站 A 有一个名为 subby.websitea.com 的子域,它通过 A 名称连接到另一个服务器.有人告诉我,为了使 subby.websitea.com 成为网站 A(即 websitea.com/subby/)的子文件夹,需要反向代理.

We have website A and website B. Website A has a subdomain called subby.websitea.com, which connects via A name to ANOTHER server. I was told that in order to make subby.websitea.com APPEAR as a subFOLDER of website A (ie. websitea.com/subby/) than a reverse proxy is needed.

好吧,我整晚都在查看文档,但我只是......我不了解基础知识!我的主人很友好地使用此处列出的信息设置了我们的 VPS:http://www.apachetutor.org/admin/reverseproxys

well, I've been looking at documentation all night and I just.... I don't get the basics! My host was kind enough to set up our VPS with the info outlined here: http://www.apachetutor.org/admin/reverseproxies

但是……然后呢!?我如何使这项工作?我现在要编辑 htaccess 文件吗?我还没有找到一个很好的简单解释它是如何工作的.我喜欢学习,但我想我必须先克服这个基本的问题...... :)

But... then what!? How do I make this work? Do I now edit the htaccess file? I haven't found a good simple explanation of how it works. I love learning, but I think I have to get over this basic hump first.... :)

推荐答案

由于它是您问题的一部分(或全部?),反向代理基本上是一个网关,或者是服务器与其客户端之间的中介.请求被发送到反向代理,它(反向代理)将它们转发到服务器.
相反,还有许多其他功能,例如负载平衡和缓存.我想 Google 搜索应该会为您提供有关此事的更多资源和文档.

Since it's part (or all of it?) of your question, a reverse proxy is basically a gateway, or intermediary between a server and its clients. Requests are sent to the reverse proxy, and it (the reverse-proxy) forwards them to the server.
There are lots of other features on a reverse, like load-balancing and caching. I guess a Google search should point you to more resources and documentations on the matter.

据我所知,您有两个网站(subby.websitea.com/www.websitea.com),并且希望将www.websitea.com/subby"转发到subby.websitea.com".

As I understand it, you have two websites (subby.websitea.com / www.websitea.com) and you want 'www.websitea.com/subby' to forward to "subby.websitea.com".

编辑部分:您可以访问 Apache 配置,因此您需要在 httpd.conf 中启用 mod_proxy 和 mod_proxy_http.然后取消注释

EDITED PART: You have access to Apache config, so you need to enable mod_proxy and mod_proxy_http in httpd.conf. Then uncomment

Include extra/httpd-vhost.conf

(在 http.conf 中,在文件末尾).

(in http.conf, at the end of the file).

然后您必须编辑 httpd-vhost.conf 文件以添加您的代理指令.

You must then edit the httpd-vhost.conf file to add your proxy directives.

<VirtualHost *:80>
/* Other default config like Documentroot, etc */
ProxyRequests Off
ProxyPass /subby/ http://subby.websitea.com/
ProxyPassReverse /subby/ http://subby.websitea.com/
</VirtualHost>

现在,http://www.websitea.com/subby/ 中的所有内容都会转发到 http://subby.websitea.com 且地址不会改变.

Now, everything that comes in http://www.websitea.com/subby/ would be forwarded to http://subby.websitea.com without the adress getting altered.

再次我忘了说:每次更改 .conf 文件中的某些内容时,请记得重新启动 Apache.

EDIT AGAIN: I forgot to say: remember to restart Apache each time you change something in the .conf files.

希望这会有所帮助.

这篇关于反向代理的基础知识?我错过了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:05