标签:http io ar 使用 sp for on art bs
nginx主页:http://nginx.org/
nginx for windows:http://nginx.org/en/docs/windows.html
学习nginx:http://wiki.nginx.org/GettingStarted
以下为location的demo,汇总常见配置以及它们的对比:
demo1(匹配度由低到高):
#1 location / { return 500; } #2 location /a/ { return 404; } #3 location ~* \.jpg$ { return 403; } #4 location ^~ /a/ { return 402; } #5 location /a/1.jpg { return 401; } #6 location = /a/1.jpg { return 400; }
demo2(关于安全性):
location ~* \.php$ { proxy_pass http://www.baidu.com; } location ^~ /upload/ { if ($request_filename ! ~* \.(jpg|jpeg|gif|png|swf|zip|rar|txt)$) { return 403; } alias /home/www/html/upload/; }
demo3(正则按顺序匹配):
location ~* \.jpg$ { return 402; } location ~* 1\.jpg$ { return 403; }
标签:http io ar 使用 sp for on art bs
原文地址:http://my.oschina.net/wnjustdoit/blog/348282