标签:list div 成功 type 区分 serve keep stream index
nginx下面的location是有优先级的,由高到低如下:
下面是一个典型配置:
user root; events {worker_connections 1024;} http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8080; #优先级第4 location / { content_by_lua ‘ngx.say("success4") ngx.exit(ngx.OK)‘; } #优先级第2 location ^~ /hls { content_by_lua ‘ngx.say("success2") ngx.exit(ngx.OK)‘; } #优先级第3 location ~* index\.m3u8 { content_by_lua ‘ngx.say("success3") ngx.exit(ngx.OK)‘; } #优先级第1 location = /hls/demo/index.m3u8 { content_by_lua ‘ngx.say("success1") ngx.exit(ngx.OK)‘; } } }
下面是运行结果:
curl http://127.0.0.1:8080/hls/demo/index.m3u8 success1 curl http://127.0.0.1:8080/hls/demo2/index.m3u8 success2 curl http://127.0.0.1:8080/3hls/demo/index.m3u8 success3 curl http://127.0.0.1:8080/hls/demo/index4.m3u8 success2 curl http://127.0.0.1:8080/5hls/demo/index4.m3u8 success4
标签:list div 成功 type 区分 serve keep stream index
原文地址:https://www.cnblogs.com/yuandaozhe/p/12072456.html