nginx的location正则匹配问题

qq_23748135 2015-02-02 12:37:52

http://abc.com/A852131E3f2
http://abc.com/DF22d8541z2
http://abc.com/DF22d8541z21
http://abc.com/8F22d8541z2
http://abc.com/dF22d8541z2

上面的URL我想匹配首字母是A-D后面跟10位a-zA-Z0-9

http://abc.com/A852131E3f2
http://abc.com/DF22d8541z2

这个正则怎么写呢?
...全文
190 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_23748135 2015-02-02
  • 打赏
  • 举报
回复
引用 10 楼 xmt1139057136 的回复:
看看这个群。nginx/tomcat/监控 189651781 问问他们!!
谢谢
业余草 2015-02-02
  • 打赏
  • 举报
回复
看看这个群。nginx/tomcat/监控 189651781 问问他们!!
qq_23748135 2015-02-02
  • 打赏
  • 举报
回复
引用 8 楼 xmt1139057136 的回复:
学习地址:http://blog.csdn.net/a519640026/article/details/9138487 nginx配置详解:http://blog.csdn.net/xmtblog/article/details/42295181 多百度百度,多搜索搜索!!
- 第一个链接已经看了,但看不懂,第二篇看完了,获益良多 路径匹配还是弄不好。。。。。
业余草 2015-02-02
  • 打赏
  • 举报
回复
学习地址:http://blog.csdn.net/a519640026/article/details/9138487 nginx配置详解:http://blog.csdn.net/xmtblog/article/details/42295181 多百度百度,多搜索搜索!!
qq_23748135 2015-02-02
  • 打赏
  • 举报
回复
引用 6 楼 xmt1139057136 的回复:
^A|D[a-zA-Z0-9]{10}
还是错的 是不是跟版本有关系?

server {
	listen 80;
	server_name tobosu.com www.tobosu.com;
	index index.html;
	location ^A|D[a-zA-Z0-9]{10} {
		proxy_pass http://192.168.0.15:80/;
		proxy_redirect off;
		proxy_set_header Host t1.apache.localhost;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Referer $http_referer;
		proxy_set_header Cookie $http_cookie;
		proxy_connect_timeout 60;
		proxy_read_timeout 600;
		proxy_send_timeout 600;
	}
}

业余草 2015-02-02
  • 打赏
  • 举报
回复
^A|D[a-zA-Z0-9]{10}
业余草 2015-02-02
  • 打赏
  • 举报
回复
 ^A|D[a-zA-Z0-9]{0,10}$
qq_23748135 2015-02-02
  • 打赏
  • 举报
回复
引用 3 楼 xmt1139057136 的回复:
^A|D[a-zA-Z0-9]{10}$ 不好意思写错了
也报错了。。。。 location ^A|D[a-zA-Z0-9]{10}$ { 正在启动 nginx:nginx: [emerg] unknown directive "10}$"
业余草 2015-02-02
  • 打赏
  • 举报
回复
^A|D[a-zA-Z0-9]{10}$ 不好意思写错了
qq_23748135 2015-02-02
  • 打赏
  • 举报
回复
引用 1 楼 xmt1139057136 的回复:
^A|D[a-zA-Z0-9]{10}&
location ^A|D[a-zA-Z0-9]{10}& { 不行啊,报错了 正在启动 nginx:nginx: [emerg] unknown directive "10}&"
业余草 2015-02-02
  • 打赏
  • 举报
回复
^A|D[a-zA-Z0-9]{10}&

25,980

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧