0
点赞
收藏
分享

微信扫一扫

nginx $request_uri map 白名单

正义的杰克船长 2022-03-15 阅读 108

worker_processes  1;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    keepalive_timeout  65;

    #gzip  on;
	map_hash_max_size 550;
	map_hash_bucket_size 500;
	map $request_uri $allow_uri {
		default 0;
		~/api/xxx\?.* 1;
		~/api/xxxs\?.* 1;
	}

    server {
        location / {
			if ( $allow_uri != 1 )
            {
                return 403;
            }
            proxy_pass   xxx:444;
        }
    }

}
举报

相关推荐

0 条评论