zoukankan      html  css  js  c++  java
  • nginx proxy

    listen 80;
    server_name localhost;
    
    # 访问"localhost"的全部请求会被转发到"localhost:81"
    # localhost => localhost:81
    # localhost/a/ => localhost:81/a/
    # localhost/b/ => localhost:81/b/
    location / {
     proxy_pass http://localhost:81;
    }
    
    # 访问"localhost"的全部请求会被转发到"localhost:81/a/"
    # localhost => localhost:81/a/
    # localhost/a/ => localhost:81/a/a/
    # localhost/b/ => localhost:81/a/b/
    location / {
     proxy_pass http://localhost:81/a/;
    }
    
    
    # 访问"localhost/c/"的全部请求会被转发到"localhost:81/a/"
    # localhost => 不会转发
    # localhost/c/ => localhost:81/a/
    # localhost/c/aa/ => localhost:81/a/aa/
    location /c/ {
     proxy_pass http://localhost:81/a/;
    }
    
    # 访问"localhost/api/"的全部请求会被转发到"localhost:81"
    # localhost => 不会转发
    # localhost/api/ => localhost:81
    # localhost/api/a/ => localhost:81/a/
    # localhost/api/b/ => localhost:81/b/
    location /api/ {
      # rewrite 的作用是修改URI
      rewrite ^/api(/.*)$ $1 break;
      proxy_pass http://localhost:81;
    }
    
    # http://localhost/api/ => http://127.0.0.1:81/
    # http://localhost/api/a/ => http://127.0.0.1:81/a/
    # http://localhost/api/b/ => http://127.0.0.1:81/b/
    # http://localhost/api/?path=/a => http://127.0.0.1:81/a
    # http://localhost/api/?path=/b => http://127.0.0.1:81/b
    location /api/ {
      if ($arg_path = '') {
        rewrite ^/api(/.*) $1 break;
        set $arg_path $1;
      }
      proxy_pass http://127.0.0.1:81$arg_path;
    }
    
  • 相关阅读:
    集合
    二维数组
    数组案例
    数组
    date time 和string
    if和for的案例
    if条件语句 for循环语句
    Windows Azure Mangement API 之 更方便的使用Mangement API
    Azure Table storage 之改进DynamicTableEntity类为其添加动态语言扩展
    Windows Azure Table storage 之 动态Table类 DynamicTableEntity
  • 原文地址:https://www.cnblogs.com/ajanuw/p/14305212.html
Copyright © 2011-2022 走看看