存档

‘nginx’ 分类的存档

nginx的log

2010年1月29日 flex 没有评论

access_log的最小作用域是location,关闭方式是:access_log off;

error_log的最小作用域是http,关闭方式是:error_log /dev/null;

如果一个请求是404之类的,则access_log中记录404,error_log同时会记录open filename failed等错误,如果不需要,可以改变http域error_log的记录等级,也可以直接关闭(还有log_not_found选项可以关闭记录open filename failed错误)。

nginx的rewrite

2010年1月28日 flex 没有评论

设置nginx的rewrite如果替换项是以http://开头,则起的是redirect的作用,即使最后的参数是last不是redirect,例如:

rewrite ^(.*)$ http://aaa.bbb.com/ccc$1 last;

浏览器端会得到302。

nginx的文档里提到:

redirect – returns temporary redirect with code 302; it is used if the substituting line begins with http://

另外,rewrite后的host的使用顺序如下:

  1. 当请求的http头里的host匹配sever_name里的任一host时,使用此host
  2. 若不匹配,或者为空,使用server_name的第一个host
  3. 若没有设置server_name,则使用本机的hostname
  4. 若要一直使用http头里的host,则将server_name设置为:servername _ *;(下划线不能少,因为 * 不能做为sever_name第一项的开头)
分类: nginx, 运维 标签: ,

nginx fancyindex插件严重影响效率

2010年1月5日 flex 4 条评论

补记:

nginx的fancyindex插件能提供定制性更好的index页面(插件许久没有更新,有一个小的bug,含有冒号的url不能正确生成,稍稍改下代码就行了)。不过经过一段时间高负载的使用后,发现页面载入延迟比较高,使用ab局域网压力测试的结果(nginx 0.7.64)表明fancyindex的效率只有原生autoindex的37.5%。

分类: nginx, 运维 标签: ,