nginx反向代理通俗讲解(nginx 反向代理之 proxy_pass的实现)
类别:服务器 浏览量:2127
时间:2022-01-20 00:21:17 nginx反向代理通俗讲解
nginx 反向代理之 proxy_pass的实现格式很简单: proxy_pass URL;
其中URL包含:传输协议(http://, https://等)、主机名(域名或者IP:PORT)、uri。
示例如下:
proxy_pass http://www.xxx.com/; proxy_pass http://192.168.200.101:8080/uri; proxy_pass unix:/tmp/www.sock;
对于proxy_pass的配置有几种情况需要注意:
假设server_name为www.xxx.com
当请求http://www.xxx.com/aming/a.html的时候,以上示例分别访问的结果是
示例1:
location /aming/ { proxy_pass http://192.168.1.10; ... }
结果1:http://192.168.1.10/aming/a.html
示例2:
location /aming/ { proxy_pass http://192.168.1.10/; ... }
结果2:http://192.168.1.10/a.html
示例3:
location /aming/ { proxy_pass http://192.168.1.10/linux/; ... }
结果3:http://192.168.1.10/linux/a.html
示例4:
location /aming/ { proxy_pass http://192.168.1.10/linux; ... }
结果4:http://192.168.1.10/linuxa.html
总结:
为了方便记忆和规范配置,建议所有的 proxy_pass 后的url都以“/”结尾。
proxy_pass http://192.168.1.10/linux/;
到此这篇关于nginx 反向代理之 proxy_pass的实现的文章就介绍到这了,更多相关nginx 反向代理 proxy_pass内容请搜索开心学习网以前的文章或继续浏览下面的相关文章希望大家以后多多支持开心学习网!
您可能感兴趣
- nginx动态路径配置(Nginx本地目录映射实现代码实例)
- nginx如何配置不显示nginx名字(Nginx安装完成没有生成sbin目录的解决方法)
- nginx配置root后的路径打不开(详解nginx.conf 中 root 目录设置问题)
- nginx怎么进一步配置(Nginx已编译的nginx-添加新模块)
- nginx配置详解(Nginx进程管理和重载原理详解)
- nginx 配置https(Nginx下配置Https证书详细过程)
- nginx动静分离的原理(Nginx动静分离实现案例代码解析)
- nginx负载均衡器的作用(Nginx 负载均衡是什么以及该如何配置)
- linux系统查看nginx系统版本(Linux中Nginx的防盗链和优化的实现代码)
- nginx负载均衡高怎么用(Nginx + consul + upsync 完成动态负载均衡的方法详解)
- nginx结构图解(详解Nginx 工作原理)
- nginx-rtmp-module 配置(Nginx搭建rtmp直播服务器实现代码)
- nginx配置404状态码(解决Nginx 配置 proxy_pass 后 返回404问题)
- linux下安装nginx常见问题(Linux安装Nginx步骤详解)
- dockernginx怎么设置容器(docker nginx + https 子域名配置详细教程)
- nginx部署配置详解(Nginx服务器基本的模块配置和使用全攻略)
- 菲律宾游学(菲律宾游学中介机构)
- 菲律宾美食(菲律宾美食排行榜前十名)
- 菲律宾特产(菲律宾特产最值得买回国)
- 越南特产(越南特产首饰)
- TVB负评王连续挑战警察角色《使徒行者3》中将饰演卧底(TVB负评王连续挑战警察角色使徒行者3中将饰演卧底)
- 《精英律师》剧照首曝光,实力演员飙戏,演绎律政职场百态(精英律师剧照首曝光)
热门推荐
排行榜
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9