简体   繁体   English

如何配置Apache Proxy? 需要将没有域名的请求发送到差异服务器

[英]How to configure Apache Proxy? Need to send requests without a domain name to a diff server

I have a CentOS 6.7 server with Webmin and Virtualmin installed, hosting 15+ websites. 我有一台装有Webmin和Virtualmin的CentOS 6.7服务器,可托管15个以上的网站。

All works as it should. 一切正常。

However, if a request comes in without a domain name (directly to http://1.1.1.1 for example) I want to send that to another server on my local network say 192.168.1.10 但是,如果传入的请求没有域名(例如直接发送到http://1.1.1.1 ),我想将其发送到本地网络上的另一台服务器,例如192.168.1.10。

I have done this before and dont remember it being complicated, but now I have spent many hours and frustration trying to make this work 我以前做过这个,并且不记得它很复杂,但是现在我花了很多时间和挫败感来尝试完成这项工作

I do not want to misconfigure Apache and end up letting hackers laugh at me and proxy thru my server, so I want to make sure it is configured correctly 我不想配置错误的Apache,最终让黑客嘲笑我并通过我的服务器代理,所以我想确保它的配置正确

I havent been able to make it work yet. 我还没有能够使它工作。

Here is my config: 这是我的配置:

<IfModule mod_proxy.c>
ProxyRequests On
<Proxy *>
    Order allow,deny
    Allow from all
</Proxy>

#
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#
ProxyVia On

#
# To enable a cache of proxied content, uncomment the following lines.
# See http://httpd.apache.org/docs/2.2/mod/mod_cache.html for more details.
#
#<IfModule mod_disk_cache.c>
#   CacheEnable disk /
#   CacheRoot "/var/cache/mod_proxy"
#</IfModule>
#

</IfModule>


<VirtualHost *:*>
    ProxyPreserveHost On

    ProxyPass / http://192.168.1.1:80/
    ProxyPassReverse / http://192.168.1.1:80/


</VirtualHost>

I GOT IT!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 我知道了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

It can be fixed within Webmin/Virtualmin itself. 它可以在Webmin / Virtualmin本身中修复。

Just go to Virtualmin > (your default website) > Server Config > Edit Proxy Website 只需转到Virtualmin>(您的默认网站)>服务器配置>编辑代理网站

then put in your proxy address and enable it 然后输入您的代理地址并启用它

like http://192.168.1.1:80 http://192.168.1.1:80

it has to be in that form, for example 192.168.1.1 WILL NOT WORK :) 它必须采用这种形式,例如192.168.1.1将无法工作:)

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

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