Nginx配置proxy_pass转发的/路径
请求原地址 :http://servername/static_js/test.html
location ^~ /static_js/
{
proxy_cache js_cache;
proxy_set_header Host js.test.com;
proxy_pass http://js.test.com/;
} 或者 使用rewrite location ^~ /static_js/
{
proxy_cache js_cache;
proxy_set_header Host js.test.com;
rewrite /static_js/(.+)$ /$1 break;
proxy_pass http://js.test.com;
}
代理成 http://js.test.com/test.html
location ^~ /static_js/
{
proxy_cache js_cache;
proxy_set_header Host js.test.com;
proxy_pass http://js.test.com;
}
代理成 http://js.test.com/static_js/test.htm
域名跳转 访问 crm6yy_proxy.xxx.com 跳转到 crm6yy.xxx.com
server {
listen 80 ;
server_name crm6yy_proxy.xxx.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://crm6yy.xxx.com/;
}
}
正向代理
场景
A 不能上外网
B 能上外网 (A和B可以互相访问)
C 外面的网站 http://www.baidu.com
B上nginx配置如下代码
resolver 8.8.8.8;
server {
listen ; location / {
proxy_pass $scheme://$http_host$request_uri;
}
}
使用:
在A机器访问:
或者 curl -x B:8090 -k "C"
或者 export http_proxy="http://B:8090"
或者windows下:在internet选项->连接->局域网设置->代理服务器 填入ip及端口即可
Nginx配置proxy_pass转发的/路径的更多相关文章
- Nginx配置proxy_pass转发的/路径问题
Nginx配置proxy_pass转发的/路径问题 在nginx中配置proxy_pass时,如果是按照^~匹配路径时,要注意proxy_pass后的url最后的/,当加上了/,相当于是绝对根路径,则 ...
- Nginx配置proxy_pass转发/路径问题
proxy_ignore_client_abort on; #不允许代理端主动关闭连接 upstream的负载均衡,四种调度算法 #调度算法1:轮询.每个请求按时间顺序逐一分配到不同的后端服务器,如果 ...
- Nginx配置proxy_pass
nginx配置proxy_pass,需要注意转发的路径配置 1.location /test/ { proxy_pass http://t6:8300; } 2.location /test/ { p ...
- 记录一次 Nginx 配置 proxy_pass 后 返回404问题
一. Nginx 配置 proxy_pass 后 返回404问题 故障解决和定位 1.1. 问题 在一次生产涉及多次转发的配置中, 需求是下面的图: 在配置好了 proxy_pass 之后,请求 ww ...
- nginx配置https转发到tomcat(使用自签名的证书)
一.使用openSSL生成自签名的证书 1.生成RSA私钥 命令:openssl genrsa -des3 -out server.key 1024 说明:生成rsa私钥,des3算法,1024强度, ...
- Nginx配置域名转发实例
域名:cps.45wan.com 所在阿里云主机:123.35.9.12 45wan没有在阿里云备案 67wan已经在阿里云备案 阿里云主机(假如123.35.9.12)上原来的nginx配置: ...
- Nginx配置proxy_pass【转载】
在nginx中配置proxy_pass时,当在后面的url加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走. 下面四种 ...
- nginx 配置proxy_pass URL末尾加与不加/(斜线)的区别
nginx在配置proxy_pass的时候 URL结尾加斜线(/)与不加的区别和注意事项 假设访问路径的 /pss/bill.html 加/斜线的情况 location /pss/ { proxy_p ...
- nginx配置proxy_pass URL末尾加与不加/(斜线)的区别
nginx在配置proxy_pass的时候 URL结尾加斜线(/)与不加的区别和注意事项 假设访问路径的 /pss/bill.html 加/斜线的情况 location /pss/ { proxy_p ...
随机推荐
- powershell 远程重启/关闭服务器
powershell 远程重启/关闭服务器 #启动winrm PS C:\Windows\system32> winrm quickconfig -q #设置信任主机 PS C:\Windows ...
- [JS Compose] 7. Ensure failsafe combination using monoids
monoids is a semi-group with a neutral element. A semigroup, it does not have an element to return s ...
- vue - 路由传递参数
结构目录 1. 页面传值(不同之间的页面传值) 1.1 index.js配置 源码: // 引入vue框架 import Vue from 'vue' // 引入vue-router路由依赖 impo ...
- 算法笔记_154:算法提高 日期计算(Java)
目录 1 问题描述 2 解决方案 1 问题描述 问题描述 已知2011年11月11日是星期五,问YYYY年MM月DD日是星期几?注意考虑闰年的情况.尤其是逢百年不闰,逢400年闰的情况. 输入格式 ...
- sparkContext 读取hdfs文件流程及分片机制
- oracle的常规操作(基本命令)
Oracle基本命令 前言:... 3 连接数据库:... 3 使用sql*plus连接oracle. 3 命令方式... 3 文件操作命令... 3 显示和设置环境变量... 3 查看当前所有表.. ...
- 调试Felix Framework
这里是指用Eclipse调试Felix Framework自身. 1. 首先安装Eclipse Java EE,然后再安装Java Source Attacher,这样才会在Jar文件的右键菜单“属性 ...
- powershell执行脚本
powershell执行脚本 执行powershell脚本有两种方式: 1.通过命令行参数启动脚本 C:\Windows\System32\WindowsPowerShell\v1.0\power ...
- TP5.0生成模块(home/admin)命令
TP5.0> 进入项目根目录(tp5/),执行以下命令: > php think make:controller 模块名/控制器名 //语法 > php think make:con ...
- (二)hibernate进阶
1.hibernate.cfg.xml常用配置以上节代码为例 <session-factory> <property name="connection.username&q ...