美文网首页
nginx location

nginx location

作者: 小道小姐姐 | 来源:发表于2018-07-14 22:10 被阅读0次

location 是在server块中配置,可以根据不同的uri使用不同的配置(location中配置),来处理不同的请求。location是有顺序的,会被第一个匹配的location处理。
location 配置demo

  1. =, 精确匹配
    2.~,大小写敏感
    3.~*,大小写忽略
  2. ^~,只匹配以uri开头
    5.@, nginx 内部跳转
    nginx 配置proxy_pass url末尾加与不加/的区别
    假设访问路径的/pss/bill.html
    加/斜线的情况:
    location /pss/ {
    proxy_pass http://127.0.0.1:8081/;
    }
    被代理的真实访问路径为http://127.0.0.1:8081/bill.html
    不加/的情况:
    location /pss/ {
    proxy_pass http://127.0.0.1:8081;
    }
    被代理的真实访问路径为http://127.0.0.1:8081/pss/bill.html
    ,

相关文章

网友评论

      本文标题:nginx location

      本文链接:https://www.haomeiwen.com/subject/yimeyftx.html