网站首页 > 技术教程 正文
前言
日常不管是研发还是运维,都多少会使用Nginx服务,很多情况Nginx用于反向代理,那就离不开使用proxy_pass,有些同学会对 proxy_pass 转发代理时 后面url加 /、后面url没有 /、后面url添加其它路由等场景,不能很明白其中的意思,下面来聊聊这些分别代表什么意思。
详解
客户端请求 URL https://172.16.1.1/hello/world.html
第一种场景 后面url加 /
location /hello/ {
proxy_pass http://127.0.0.1/;
}
结果:代理到URL:http://127.0.0.1/world.html
第二种场景 后面url没有 /
location /hello/ {
proxy_pass http://127.0.0.1;
}
结果:代理到URL:http://127.0.0.1/hello/world.html
第三种场景 后面url添加其它路由,并且最后添加 /
location /hello/ {
proxy_pass http://127.0.0.1/test/;
}
结果:代理到URL:http://127.0.0.1/test/world.html
第四种场景 后面url添加其它路由,但最后没有添加 /
location /hello/ {
proxy_pass http://127.0.0.1/test;
}
结果:代理到URL:http://127.0.0.1/testworld.html
猜你喜欢
- 2024-10-12 反向代理神器:Nginx Proxy Manager,支持https证书自动申请和续签
- 2024-10-12 【第1期】Nginx: nginx之反向代理 proxy_pass
- 2024-10-12 好物推荐 - NginxProxyManager(好物推荐排行榜前100名)
- 2024-10-12 Docker部署反向代理神器:Nginx Proxy Manager
- 2024-10-12 NGINX 实战操作(yarn-proxy)(nginx使用教程)
- 2024-09-22 云原生网关Traefik和Nginx Proxy Manager初体验
- 2024-09-22 程序员快速上手 Nginx 运行原理之“失败重试”精华笔记
- 2024-09-22 技术积淀----NGINX缓存(nginx内存缓存)
- 2024-09-22 nginx动态proxy_pass(Nginx动态二级域名)
- 2024-09-22 你真的了解Nginx的proxy_pass指令吗?
你 发表评论:
欢迎- 08-06linux 和 windows文件格式互相转换
- 08-06谷歌 ChromeOS 已支持 7z、iso、tar 文件格式
- 08-06Linux下比较文件内容的6种方法
- 08-06文件格式及功能汇总
- 08-0610个Linux文件内容查看命令的实用示例
- 08-06Linux-如何区分不同文件类型
- 08-06Zabbix技术分享——监控windows进程资源使用情况
- 08-06Linux系统卡顿?学会ps命令这三招,轻松定位问题进程
- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)