nginx反向代理表达式的含义
来源:互联网 发布:数据铁笼的概念 编辑:程序博客网 时间:2024/05/29 17:02
nginx配置location [=|~|~*|^~] /uri/ { … }的基本用法表达含义
= 严格匹配。如果这个查询匹配,那么将停止搜索并立即处理此请求。
~ 为区分大小写匹配(可用正则表达式)
!~为区分大小写不匹配
~* 为不区分大小写匹配(可用正则表达式)
!~*为不区分大小写不匹配
^~ 如果把这个前缀用于一个常规字符串,那么告诉nginx 如果路径匹配那么不测试正则表达式。
location = / {
# 只匹配 / 查询。
}
location / {
}
location ^~ /images/ {
# 匹配任何已 /images/ 开头的任何查询并且停止搜索。任何正则表达式将不会被测试。
}
location~*.(gif|jpg|jpeg)$ {
# 匹配任何已 gif、jpg 或 jpeg 结尾的请求。
}
location ~*.(gif|jpg|swf){
valid_referers none blocked start.igrow.cn sta.igrow.cn;
if (invalid_referer) {
#防盗链
rewrite ^/ http://$host/logo.png;
}
}
#user nobody;worker_processes 1;# 指定工作衍生进程数#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events { worker_connections 1024;# 允许的连接数}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name 127.0.0.1; charset utf-8; location / { #匹配任何路径 proxy_pass http://localhost:6004; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /baoli/ { #匹配包含baoli的开头的路径,正则不测试 proxy_pass http://localhost:6001; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /xydd/ { proxy_pass http://localhost:6009; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /tpmbaoli/ { proxy_pass http://localhost:6022; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /tpmxydd/ { proxy_pass http://localhost:6011; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /wf/ { proxy_pass http://localhost:6008; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /inventory/ { proxy_pass http://localhost:6007; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /prd-yyw/ { proxy_pass http://localhost:6010; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /gwmgt/ { proxy_pass http://localhost:6002; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /cdzy/ { proxy_pass http://localhost:6020; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /cdzytpm/ { proxy_pass http://localhost:6023; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /sydd/ { proxy_pass http://localhost:6021; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /cpcn/ { proxy_pass http://localhost:6015; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /monitor/ { proxy_pass http://localhost:6014; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /account/ { proxy_pass http://localhost:6018; proxy_set_header Host $host; proxy_set_header X-Real-IP localhost; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 400 404 500 502 503 504 /50x.html; location = /50x.html { root html; } }}
阅读全文
0 0
- nginx反向代理表达式的含义
- 反向代理的含义
- nginx的反向代理
- nginx的反向代理
- Nginx的反向代理
- nginx的反向代理
- nginx的反向代理指令
- nginx的反向代理缓存
- Nginx反向代理的配置
- nginx的反向代理缓存
- nginx的反向代理缓存
- Nginx反向代理的配置
- NGINX反向代理的配置
- nginx的反向代理配置
- Nginx反向代理的配置
- 关于Nginx的反向代理
- nginx简单的反向代理
- nginx的反向代理是什么意思
- 【云星数据---大数据部集群署系列005】:hadoop3.0全分布部署方案
- 赌博游戏 概率dp
- MyBatis中调用存储过程和函数
- eclipse
- static关键字----->单例模式
- nginx反向代理表达式的含义
- Linux-----第三课:dev_mountpoint
- Could not publish server configuration for Tomcat v7.0 Server at localhost.
- 表单那些事——ios浏览器表单上<input type="submit" />不一致的解决方法
- 九章算法 第一节 Algorithm Interview & Coding Style
- DataGridView显示Excel表格
- 容器map与set的增删查改
- jQuery控制table进行添加和删除
- 向有序的环形单链表中插入新节点