Docker安装的Nginx如何代理宿主机的服务
1、在安装Docker的时候,会在宿主机安装一个虚拟网关 docker0,查询docker0的IP地址
ip addr show docker0
2、配置docker上安装的nginx
server { listen 80; server_name www.test.co; location / { # 设置最大允许上传单个的文件大小 client_max_body_size 100m; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 反向代理到 tomcat proxy_pass http://172.17.0.1:7190; } }
3、主机内测试tomcat服务请求
4、测试外部访问
相关推荐
nginxs 2020-11-14
时光流水 2020-09-23
王道革 2020-11-25
bwyyziq 2020-11-22
pigsmall 2020-11-19
changecan 2020-11-19
helloWorldAndYou 2020-11-16
红石丶 2020-11-13
WanKaShing 2020-11-12
yangkang 2020-11-12
滴水穿石点石成金 2020-11-12
张荣珍 2020-11-12
wuxunanjing 2020-11-11
魅惑青花瓷 2020-11-11
lihongtai 2020-11-09
yangkang 2020-11-09
worldsnow 2020-11-06
MichaelJScofield 2020-11-06