readme.md 2.41 KB

java nginx 配置文件

说明

这些文件需要copyopenrestyhome 目录

IP block endpoints

切换

短链接服务

生成短链接 (限制内网访问)

curl  -X POST -d "uri=http://www.yoho.cn"   "http://yhurl.com/gs"

响应: 注意需要处理转义字符


{"code":200,"uri":"http:\/\/yhurl.com\/1THVRTV"}

动态upstream的支持

基于 lua-upstream-nginx-module 动态设置upstream的 up, down

  1. 查询所有的upstreams信息:

curl -i -H "Host: erp.yoho.yohoops.org" "http://127.0.0.1/upstreams?method=list&upstream=apigateway"

  1. 设置 upstream 名称为 apigatewayupstream 第0个 backend server 状态为down

curl -i -H "Host: erp.yoho.yohoops.org" "http://127.0.0.1/upstreams?method=down&upstream=apigateway&id=0"

  1. 设置upstream 名称为 apigatewayupstream 第0个 backend server 状态为up:

curl -i -H "Host: erp.yoho.yohoops.org" "http://127.0.0.1/upstreams?method=up&upstream=apigateway&id=0"

list 接口响应:


{
    "name": "apigateway", 
    "value": [
        {
            "backup": false, 
            "name": "172.31.70.77:8080", 
            "down": false, 
            "id": 0
        }, 
        {
            "backup": false, 
            "name": "172.31.70.113:8080", 
            "down": false, 
            "id": 1
        }, 
        {
            "backup": false, 
            "name": "172.31.70.8:8080", 
            "down": false, 
            "id": 2
        }, 
        {
            "backup": false, 
            "name": "172.31.70.104:8080", 
            "down": false, 
            "id": 3
        }
    ]
}