简体   繁体   English

设置虚拟主机文件以托管来自远程服务器的源代码

[英]Setup virtual hosts file to host the source code from remote server

I would really appreciate your support for the below inquiry 非常感谢您对以下查询的支持

Current Situation: 现在的情况:

I have a web app (contains a module to upload documents) on a Linux Apache server "A" that can only be HTTP-ed through the intranet. 我在Linux Apache服务器“ A”上有一个Web应用程序(包含一个用于上传文档的模块),该服务器只能通过Intranet进行HTTP编码。

Required: 需要:

Another Linux Apache server "B" is required to host the same web app, while maintaining the source code on server "A" only. 需要另一个Linux Apache服务器“ B”来托管同一Web应用程序,同时仅将源代码保留在服务器“ A”上。 Server "B" can be HTTP-ed through the internet and intranet. 服务器“ B”可以通过Internet和Intranet进行HTTP编码。

Blocking points: 阻塞点:

Under the current circumstances we are unable to host the website on server "B" directly (which would seem like the logical solution). 在当前情况下,我们无法将网站直接托管在服务器“ B”上(这似乎是合理的解决方案)。

Question: 题:

Is it possible to setup the virtual-hosts of the httpd.conf file for such requirement? 是否可以为此要求设置httpd.conf文件的虚拟主机?

Research: 研究:

Usually most of my findings were posts about deploying a load-sharing/load-balancing solution ( not my objective ), or setup a two-way synchronization process between "A" and "B" (last resort solution). 通常,我的大部分调查结果都是关于部署负载共享/负载平衡解决方案的帖子( 不是我的目标 ),或者在“ A”和“ B”之间建立双向同步过程(最后的解决方案)。

Googled strings: Google字符串:

share website between two servers, host website on two servers, virtual host to another server, run single website on multiple servers setup, virtual host for website on another server, host a website on two different servers, setup two linux servers to host the same website 在两台服务器之间共享网站,在两台服务器上托管网站,在另一台服务器上托管虚拟主机,在多台服务器上运行单个网站设置,在另一台服务器上虚拟化网站的主机,在两台不同服务器上托管网站,设置两台linux服务器托管同一台网站

Server Details: 服务器详细信息:

Server A: 服务器A:

  • Server IP: 192.168.xxx.xxx (accessible through the intranet only) 服务器IP:192.168.xxx.xxx(仅可通过Intranet访问)

  • Hosts the website source code 托管网站源代码

  • Apache server Apache服务器

  • OS: RHEL5 作业系统:RHEL5

Server B: 服务器B:

  • Accessible through the intranet and internet 可通过Intranet和Internet访问

  • Apache server Apache服务器

  • OS: Same as A (RHEL5) 操作系统:与A(RHEL5)相同

Summing up what you've probably found yourself by now: unfortunately, there are two things that are called proxying. 总结到现在为止您可能已经发现的东西:不幸的是,有两件事叫做代理。 The you are interested in is called a reverse proxy , in which B will take requests and forward them to A. The client never sees that A even exists. 您感兴趣的称为反向代理 ,其中B将接收请求并将其转发给A。客户端永远不会看到A甚至存在。 There are few security concerns, depending on what angle of security you look at: 很少有安全问题,具体取决于您所关注的安全角度:

  1. server A only ever sees requests from B, not the original client, so any IP-based restrictions you want should be configured on server B. 服务器A仅能看到来自B的请求,而不能看到原始客户端的请求,因此,您想要的任何基于IP的限制都应在服务器B上进行配置。

  2. The usually mentioned security concern is that a ( forward ) proxy will ask arbitrary servers for things on behalf of the client, so it masks the client's identity. 通常提到的安全问题是,( 转发 )代理将代表客户端向任意服务器询问情况,因此它掩盖了客户端的身份。 I don't think you need to worry about this as long as you put ProxyRequests Off to disable forward proxying. 只要您ProxyRequests Off以禁用正向代理,我认为您不必为此担心。

  3. Server A might accidentally reveal its IP, which you might not be comfortable with. 服务器A可能会意外泄露其IP,您可能不满意。 When B passes back the answer to the clients request that it has received from A, it will not look at the payload. 当B将答案从A接收回客户请求时,它将不会查看有效负载。 So, if you return HTML documents, they better all have only relative paths. 因此,如果您返回HTML文档,则它们最好都只有相对路径。 I think this might be the problem you are having: if your code still contains references to 192.168.xy, those won't work for the external client. 我认为这可能是您遇到的问题:如果您的代码仍然包含对192.168.xy的引用,则这些引用将不适用于外部客户端。 If you are changing paths (ie you have something like ProxyPass /somepath http://internal-server/otherpath ), things become even more complicated, so try to avoid that. 如果您要更改路径(例如,您拥有ProxyPass /somepath http://internal-server/otherpath东西),事情会变得更加复杂,因此请避免这种情况。 (In general, your backend application would need knowledge of what its publicly-visible URIs are. How to do this depends on the application.) (通常,您的后端应用程序需要了解其公开可见的URI是什么。如何执行此操作取决于该应用程序。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM