Nginx学习——location和rewrite

location语法:

location [=|~|~*|^~] /uri/ { … }

记住以下即可:

  • 完全匹配(=)
  • 无正则普通匹配(^~)(^ 表示“非”,~ 表示“正则”,字符意思是:不要继续匹配正则)
  • 正则表达式匹配(~或者~*)
  • 普通匹配

rewrite语法:

rewrite regex replacement [flag];

flag:last,break,redirect,permanent

常用正则:

posted @ 2019-12-11 18:00  鼠标的博客  阅读(518)  评论(0编辑  收藏  举报