nginx之rewrite匹配需求
现在需求如下:
server {
listen 80;
server_name localhost; localhost为192.168.223.136
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm index.php;
}
location ^~/api/ {
root html;
rewrite ^/api/([0-9]+\.[0-9]+)/client/(.*)$ http://192.168.223.137/api/$1/client/$2 redirect;
}
然后测试匹配结果:

此篇博文持续更新。。。。
http://www.linuxidc.com/Linux/2014-01/95493.htm
nginx之rewrite匹配需求的更多相关文章
- Nginx的Rewrite正则表达式,匹配非某单词
Nginx的Rewrite正则表达式,匹配非某单词 由于要rewrite一个地址从 /mag/xx/xxx/ -> /m/xxx 但原先 /mag/xx/more/ 要保留 这就得写一个比较奇特 ...
- Nginx中location匹配及rewrite重写
目录 一.常用的Nginx正则表达式 二.location 2.1.location三类匹配类型 2.2.常用的匹配规则 2.3.location优先级 2.3.1.举例说明 2.4.实际网站使用中, ...
- nginx 带? rewrite 规则
由于需要重定向 url ,nginx需要rewrite .参考文献 http://huangqiqing123.iteye.com/blog/2083434 需求:将http://10.106.1.3 ...
- Nginx的rewrite应用
Rewrite主要的功能是实现URL重写,Nginx 的 Rewrite 规则采用 PCRE Perl 兼容正则表达式的语法进行规则匹配,如相使用 Nginx 的 Rewrite 功能,在编译 Ngi ...
- nginx location 正则匹配
nginx 统计语句1.根据访问IP统计UV awk '{print $1}' access.log|sort | uniq -c |wc -l2.统计访问URL统计PV awk '{print $7 ...
- 04 . Nginx的Rewrite重写
Rewrite简介 # Rewrite对应URL Rewrite,即URL重写,就是把传入web的请求重定向到其他URL的过程. # 当运维遇到要重写情况时,往往是要程序员把重写规则写好后,发给你,你 ...
- Nginx中rewrite实现二级域名、三级域名、泛域名、路径的重写
最常见的: 静态地址重定向到带参数的动态地址 rewrite "^(.*)/service/(.*)\.html$" $1/service.php?sid=$2 permanent ...
- nginx 配置rewrite 笔记
nginx 配置rewrite笔记: 通过下面的示例来说明一下,1. 先说说location : location 表示匹配传入的url地址,其中配置符有多种,各种情况的意义不一样: location ...
- Nginx之location 匹配规则详解
有些童鞋的误区 1. location 的匹配顺序是“先匹配正则,再匹配普通”. 矫正: location 的匹配顺序其实是“先匹配普通,再匹配正则”.我这么说,大家一定会反驳我,因为按“先匹配普通, ...
随机推荐
- R语言中的一些函数
1.控制输出数字的精度 format(123.123,digits=4) 输出4位数字123.1,如果整数超过4位,小数部分就全被略去. options(digits=4) 功能同上,不过在Rsess ...
- jQuery Mobile 总结
转载 孟祥月 博客 http://blog.cshttp://blog.csdn.net/mengxiangyue/article/category/1313478/2dn.http://blog. ...
- Code Forces 645C Enduring Exodus
C. Enduring Exodus time limit per test2 seconds memory limit per test256 megabytes inputstandard inp ...
- sublimeText前端必备插件
安装完成后的sublime text,功能单纯地就像笔记本,然而,可以下载对应的插件,使得sublime text不仅仅局限于某一单一语言的编写,此处只提及到前端方面的使用,下面是前端一般使用到的插件 ...
- protobuf在java应用中通过反射动态创建对象(DynamicMessage)
---恢复内容开始--- 最近编写一个游戏用到protobuf数据格式进行前后台传输,苦于protobuf接受客户端的数据时是需要数据类型的如xxx.parseForm(...),这样就要求服务器在接 ...
- Android实时推送
xmpp, mqtt Web socket 透傳消息
- ELK basic---http://udn.yyuap.com/doc/logstash-best-practice-cn/filter/grok.html
http://blog.csdn.net/lgnlgn/article/details/8053626 elasticsearch学习入门 input {stdin{}}filter { grok { ...
- nodejs(一)
nodejs第一章节 使用node来实现第一个http服务器 var http = require(‘http’); http.createServer(function (request, resp ...
- perl 常用命令
过滤重复字符 perl -e '$_=<STDIN>; @in = split; if (@in < 100){ @out = grep {! $hash{$_}++ } @in; ...
- 浅谈pipreqs组件(自动生成需要导入的模块信息)
简介 pipreqs的作用 一起开发项目的时候总是要搭建环境和部署环境的,这个时候必须得有个python第三方包的list,一般都叫做requirements.txt. 如果一个项目使用时virtua ...