nginx配置测试正则获取对应的值

访问会以下载文件的方式将获取到的值保存在文件中

upstream docker_2 {
    server 10.17.172.244:8080;
}

server {
    listen 81;
    server_name localhost;

    access_log  /var/log/nginx/mytest_acc.log;
    error_log  /var/log/nginx/mytest_error.log;

    location ^~/ {
        if ($args ~* "(.*)sid=(\d+)(.*)$") {
            set $id $2;
        }
        echo $id;
    }
}

 

posted @ 2021-02-08 11:52  chenjianwen  阅读(677)  评论(0编辑  收藏  举报