zoukankan      html  css  js  c++  java
  • Nginx *

    location 指令说明

    location [ = | ~ | ~* | ^~ ] uri {
    
    }
    1. = :用于不含正则表达式的 uri 前,要求请求字符串与 uri 严格匹配,如果匹配成功,就停止继续向下搜索并立即处理该请求。
    2. ~ :用于表示 uri 包含正则表达式,并且区分大小写。
    3. ~* :用于表示 uri 包含正则表达式,并且不区分大小写。
    4. ^~ :用于不含正则表达式的 uri 前,要求 Nginx 服务器找到标识 uri 和请求字符串匹配度最高的 location 后,立即使用此 location 处理请求,而不再使用 location 块中的正则 uri 和请求字符串做匹配。

    注意:如果 uri 包含正则表达式,则必须要有 ~ 或者 ~* 标识。

    192.168.0.107:80 -> 127.0.0.1:8080

    worker_processes  1;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
    
        server {
            listen       80;
            server_name  192.168.0.107;
    		
            location / {
    	    proxy_pass   http://127.0.0.1:8080;
            }
        }
    }

    http://192.168.0.107:9001/docs/ -> 127.0.0.1:8080

    http://192.168.0.107:9001/examples/ -> 127.0.0.1:8081

    worker_processes  1;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
    
        server {
            listen       9001;
            server_name  192.168.0.107;
    		
    	location / {
                root   html;
                index  index.html index.htm;
            }
    		
            location ~ /docs/ {
    	    proxy_pass   http://127.0.0.1:8080;
            }
    		
    	location ~ /examples/ {
    	    proxy_pass   http://127.0.0.1:8081;
            }
        }
    }


    https://nginx.org/en/docs/http/ngx_http_core_module.html#location

  • 相关阅读:
    unity fbx 导出动画
    Unity正交模式摄像机与屏幕适配的方法
    unity3d 代码动态添加,修改BoxCollider2D
    Unity3D 移动摇杆处理
    protobuff 编译注意事项
    sendBroadcast无法接收消息可能原因
    FB相关
    上传速度慢
    CocosCreator与Laya2.0区别
    LayaBox 常用技巧
  • 原文地址:https://www.cnblogs.com/jhxxb/p/13391965.html
Copyright © 2011-2022 走看看