查看“Apache2 reverse proxies”的源代码
来自Ubuntu中文
←
Apache2 reverse proxies
跳到导航
跳到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
This solution solves the problem of having multiple servers on a LAN which has a single router connected to the Internet. The router forwards all port 80 traffic to a single primary server. That server will then be required to act as a proxy for the other servers on the LAN, redirecting incoming traffic addressed to the URLs of those other servers to their respective LAN IP addresses. This increases the amount of traffic passing through the primary server, so is not a recommended solution for high volume situations unless the primary server is a dedicated gateway/proxy server. This method uses Apache2 virtual host configuration files on the primary server (to which the router sends port 80 traffic). *On the primary server (which will act as the proxy), create a symbolic link to enable the proxy modules in Apache2, then restart Apache2: sudo ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled sudo ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled sudo /etc/init.d/apache2 restart *Edit a virtual host file for all secondary servers: sudo gedit /etc/apache2/sites-enabled/proxiedhosts :and edit the file so that it resembles: <VirtualHost *:80> # ServerName ''internalserver2.mydomain.org'' # ProxyPreserveHost On ProxyRequests off ProxyPass / http://''192.168.1.192''/ ProxyPassReverse / http://''192.168.1.192''/ # </VirtualHost> # #<VirtualHost *:80> # #ServerName ''internalserver3.mydomain.org' # # ProxyPreserveHost On # ProxyRequests off # ProxyPass / http://''192.168.1.193''/ # ProxyPassReverse / http://''192.168.1.193''/ # #</VirtualHost> # #<VirtualHost *:80> # #ServerName ''internalserver4.mydomain.org' # # ProxyPreserveHost On # ProxyRequests off # ProxyPass / http://''192.168.1.194''/ # ProxyPassReverse / http://''192.168.1.194''/ # #</VirtualHost> :Makes each URL for each server has an entry (and obviously remove the hashmarks for each one that is active). *Activate the virtual host file by making a symbolic link to the Apache2 sites-enabled folder then restarting Apache2: sudo ln -s /etc/apache2/sites-enabled/proxiedhosts /etc/apache2/sites-enabled sudo /etc/init.d/apache2 restart == Other resources == The information for this page was synthesized from these sources: *[http://jeffbaier.com/articles/configuring-apache-virtual-hosts-for-nat/ Configuring Apache virtual hosts for NAT] -- blog tutorial for Apache ProxyPass *[http://www.raskas.be/blog/2006/04/21/reverse-proxy-of-virtual-hosts-with-apache-2/ Reverse proxy of virtual hosts with apache 2] *[http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass Apache2 mod_proxy instructions]
返回
Apache2 reverse proxies
。
导航菜单
页面操作
页面
讨论
阅读
查看源代码
历史
页面操作
页面
讨论
更多
工具
个人工具
登录
导航
首页
最近更改
随机页面
页面分类
帮助
搜索
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息