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 ...
随机推荐
- Leet Code OJ 226. Invert Binary Tree [Difficulty: Easy]
题目: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 思路分析: 题意是将二叉树全部左右子数 ...
- 双硬盘Win7装Ubuntu 12.04经验并解决无线网络不能使用问题
RFKill Many computer systems contain radio transmitters, including Wi-Fi, Bluetooth, and 3G devices. ...
- UNIX网络编程读书笔记:TCP输出、UDP输出和SCTP输出
TCP输出 下图展示了应用进程写数据到TCP套接口的过程. 每一个TCP套接口有一个发送缓冲区,我们可以用SO_SNDBUF套接口选项来改变这个缓冲区的大小. 当应用进程调用write时,内核从应用进 ...
- HDU 5312(数学推导+技巧)
首先说一下.N*(N-1)/2为三角形数,随意一个自然数都最多可由三个三角形数表示. 对于,对于给定的要求值 V, 那么其一组解可表示为 V = 6*(K个三角形数的和)+K: 即随意由k个数组成的解 ...
- QtGui.QCheckBox
A QtGui.QCheckBox is a widget that has two states: on and off. It is a box with a label. Check boxes ...
- socket shutdown 与 close 函数 的区别
假设server和client 已经建立了连接,server调用了close, 发送FIN 段给client(其实不一定会发送FIN段,后面再说),此时server不能再通过socket发送和接收数据 ...
- 〖Linux〗Debian 7.1.0 Wheezy使用ltib报错的解决办法
报错内容: scue@Link:/home/work/ltib$ ./ltib Processing platform: Phytec board with the NXP LPC32XX SoC = ...
- Oracle相关操作示例(导出导入dmp需要采用)
删除用户:drop user pnxd cascade; 导出数据:exp pnxd/padmin@A file=c:\bb.dmp full=y 导入数据:imp pnxd/padmin@PNXD ...
- 查看nginx的版本
查看nginx的版本 -v 显示 nginx 的版本-V 显示 nginx 的版本,编译器版本和配置参数 # /app/nginx/sbin/nginx -v nginx version: nginx ...
- C#:消息框
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...