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 的匹配顺序其实是“先匹配普通,再匹配正则”.我这么说,大家一定会反驳我,因为按“先匹配普通, ...
随机推荐
- mysql5.6的二进制包安装
author: headsen chen data :2018-06-08 16:21:43 1. 创建存放软件文件夹 # cd / #mkdir a 2.下载MySQL5.6二进制包 cd a w ...
- 170425、centos安装mysql5.6数据库
# rpm -qa | grep mysql ## 查看该操作系统上是否已经安装了 mysql 数据库, 有的话,可以通过 rpm -e 命令 或者 rpm -e --nodeps 命令来卸载掉 # ...
- CodeForces 639 A
Bear and Displayed Friends time limit per test2 seconds memory limit per test256 megabytes inputstan ...
- 一百本英文原著之旅 ( 15 finished )
记得去年毕业的时候,突然想看英文原著(小说.文学.技术 etc.)来提高自己的英文水平.并且那时候愣愣的有了个宏伟的目标 --> 一百本. 不过也就去年下半年断断续续的看了些页数在200左右的 ...
- 20165330 2017-2018-2 《Java程序设计》第3周学习总结
课本知识总结 第四章 类与对象 类:包括类声明和类体 基本格式: class 类名 { 类体的内容 } 类声明: class+类名(注意:类名首字母需大写) 类体:类声明之后的一对"{&qu ...
- webservice接口问题:Payload: No message body writer has been found for class domain, ContentType: application/xml
当在使用cxf-rs的webservice的时候,有时候在传输数据,会发生这种错误 错误代码: Response-Code: 500 Content-Type: text/plain Headers: ...
- sVIrt概述
sVirt概述 前面已经对seLInux的基本原理做了分析,seLinux主要就是基于主体和客体的安全上下文,进行访问决策.那么安全上下文是不是又可以理解为一个标签呢? 基于以上seLInux的特性, ...
- 解决hung_task_timeout_secs问题【方法待校验】
问题描述: kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this messag ...
- vs开发nodejs api文档生成神器-apidoc
直接生成文档的神器 apidoc 1 win+R 输入 cmd 回车 然后进入 nodejs 项目目录 例如 D:\NodeTest\newApp1 2 用npm安装 apidoc 直接输入 npm ...
- MyBatis3用户指南
1. 范围和生命周期 SqlSessionFactoryBuilder -->SqlSessionFactory-->SqlSession-->Mapper 实例 SqlSe ...