假设我希望以下客户端仅从apache2转发代理后面访问特定的internet服务器:
Client-1-IP: www.google.com
Client-2-IP: www.gmail.com
Client-3-IP: www.cnn.com
Client-4-IP: www.chess.com这个是可能的吗?我在Debian 8上运行Apache 2.4.10。目前,我允许特定的客户端通过此配置值访问整个互联网,但希望能够指定特定的客户端只能访问特定的互联网服务器:
<VirtualHost *:8080>
ProxyRequests On
Proxyvia On
<Proxy "*">
Order deny,allow
Deny from all
Allow from <ip-1>
Allow from <ip-2>
Allow from <ip-3>
</Proxy>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>谢谢。
发布于 2019-11-12 18:08:20
仅供参考,这已经在here和其他线程中进行了详细说明。在我的例子中,我希望配置一台Apache2.4服务器作为另一台机器上的Maven的转发代理,而不需要访问Internet。请注意,Apache2.4中的限制语法已更改,因此Allow/Deny/Order关键字应替换为Require子句,如here所解释的。例如,假设我们希望代理监听myhost.com:7775,只允许访问192.168.1.1,并只转发到*.maven.org或*.apache.org。然后,我们需要在vhosts配置中使用以下内容(我想可能有一种更简单的方法来组合多个允许的远程主机):
<VirtualHost myhost.com:7775>
ProxyRequests On
ProxyVia On
# block all domains except our target
<ProxyMatch ^((?!maven\.org).)*$>
Require all denied
</ProxyMatch>
<ProxyMatch ^((?!apache\.org).)*$>
Require all denied
</ProxyMatch>
# only allow our IP for a specific target
<ProxyMatch maven\.org >
Require ip 192.168.1.1
</ProxyMatch>
<ProxyMatch apache\.org >
Require ip 192.168.1.1
</ProxyMatch>
</VirtualHost>https://stackoverflow.com/questions/37109957
复制相似问题