我有一个服务器http://example.com,它前面有一个负载均衡器,名为https://example.net,执行SSL卸载,并将流量重定向到http://example.com上的端口443到8080。
服务器example.com在虚拟网络中是孤立的,无法从internet访问。负载均衡器example.net可以到达example.com并公开暴露在互联网上。
如何将Apache 8管理器web接口设置为只能从http://example.com/manager而不是从https://example.net/manager访问?
发布于 2018-03-21 17:33:04
我不知道你使用的负载均衡器,所以不能给出一个具体的配置,我自己有一个公共可访问的tomcat服务器通过Nginx作为代理。
Nginx
upstream websites {
server 192.168.x.x:8080 fail_timeout=0;
}
server {
listen 80;
listen 443 ssl;
server_name www.example.com example.com;
location / {
proxy_pass http://websites/;
include proxy_params;
}
#SSL configuration here
}我还让Nginx进行SSL终止和压缩,因为它更容易管理和设置,如果我以后想要创建负载平衡,我也可以使用Nginx,所以没有理由在Tomcat中这样做。https://www.digitalocean.com/community/tutorials/how-to-add-the-gzip-module-to-nginx-on-ubuntu-14-04
在Tomcat上,如果还没有出现,server.xml会为您的站点添加一个新的虚拟主机。
<Host name="www.example.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Alias>example.com</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="test_example_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>在管理器项目的manager.xml文件中,您可以设置谁可以访问manager HTML页面,或者将其设置为公共ip地址或跳转主机,我记得,作为标准的只有本地主机才能连接到HTML。
就我个人而言,我已经从我自己的安装中删除了manager项目,以避免与它相关的安全问题,如果管理不当,并且我不需要它。
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="192.168.1.*" />在tomcat-users.xml中为管理器设置一个用户和密码,您就可以开始了。
发布于 2018-03-21 13:46:49
在the服务器中配置Proxpass/Porxy别名。为此,您应该在HTTP(80)中进行配置,但最好的做法是您可以使用受限的访问在https中加载
https://serverfault.com/questions/903793
复制相似问题