码迷,mamicode.com
首页 > 其他好文 > 详细

location讲解:

时间:2016-03-23 11:28:40      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:location   nginx   

nginx location非常重要:

      location  /URI/ {       URI

      root "/web/htdocs";  URI存放对应的目录,访问权限

 }  

   location [ = | ~ | -* | ^~ ] URI{....}

    ocation {} @ name{....}

    location  URI  {}     对当前路径及子路径下的所有对象都生效; 

    location  = URI {}    精确匹配指定的路径;只对当前路径生效;(优先级最高)

    location  ~ URI {}    模式匹配URI,此处的URI可以使用正则表达式,~区分字符大小写;

    location  ~* URI {}   模式匹配URI,此处的URI可以使用正则表达式,~*不区分字符大小写;

    location  ^~ URI {}   不使用正则表达式(优先级次之)

  如:  location  / {

        root   /web/htdocs;   

        index  index.html; 

location  /bbs/ {          到web路径下去找bbs目录

        root   /web;  

        index  index.html; 

deny 192.168.1.5;


本文出自 “山猫” 博客,谢绝转载!

location讲解:

标签:location   nginx   

原文地址:http://cqtangbo.blog.51cto.com/2978612/1754188

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!