大佬教程收集整理的这篇文章主要介绍了Nginx代理传递配置docker,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是问题所在:
主机具有在不同端口上运行的多个docker应用程序,例如. App1 @ 3001,App2 @ 3002 … 3100等
现在我想以这种格式访问http://hostname.com/app1,http://hostname.com/app2 ..
为此,我在主机上运行Nginx,以根据子uri将请求代理到正确的端口
LOCATIOn = /app1 {
proxy_redirect http://hostname:3001/;
include /etc/Nginx/proxy_params;
}
LOCATIOn ^~ /app1 {
proxy_redirect http://hostname:3001/app1;
include /etc/Nginx/proxy_params;
}
@H_419_13@
但是,当网站的子uri更改或网站重定向时,这不起作用.
例如:
If I visit the site at hostname:3001 -> I can see the site
If I visit the site at http://hostname.com/app1 -> I can see the site
If the site page is at hostname:3001/static/index.html then when i access it as http://hostname.com/app1 the page changes to http://hostname.com/static/index.html -> I get 404.
@H_419_13@
有没有办法做到这一点?或者唯一的方法是将dns设置为app1.hostname.com并进行基于名称的路由?
以上是大佬教程为你收集整理的Nginx代理传递配置docker全部内容,希望文章能够帮你解决Nginx代理传递配置docker所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。