随笔分类 -  nginx

摘要:1.nginx作为反向代理,如果代理请求的页面不存在,返回404,但是浏览器中一片空白。要求:将404跳转到指定页面。在server段添加:error_page 404 /;不能生效,原因是需要添加一条proxy_intercept_errors on;语句。同理对于动态页面的404响应,需要添加fastcgi_intercept_errors on;语句。2.error_page语法error_page code ... [ = [ response ]] uri例如以下:error_page 404 /404.html;error_page 502 503 504... 阅读全文
posted @ 2014-02-21 10:04 silence.li 阅读(2238) 评论(0) 推荐(0)
摘要:While passing request nginx replaces URI part which corresponds to location with one indicated in proxy_pass directive. But there are two exceptions from this rule when it is not possible to determine what to replace:if the location is given by regular expression;if inside proxied location URI is ch 阅读全文
posted @ 2014-02-20 17:35 silence.li 阅读(3466) 评论(0) 推荐(0)
摘要:c俺靠这篇博文http://eyesmore.iteye.com/blog/1142162有用的配置:1.开启rewrite_log,这样在/var/log/nginx/error.log中显示匹配的规则,便于debug,理解rewrite的过程。 rewrite_log on; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log info;总结:Break和last都能阻止继续执行后面的rewrite指令,但是last如果在location下用的话,对于重写... 阅读全文
posted @ 2014-02-19 17:51 silence.li 阅读(570) 评论(1) 推荐(0)
摘要:nginx debug模式1.编译安装的话,需要添加编译参数--with-debug;大部分预编译软件包都已经包含了改参数。2.格式:error_log LOGFILE [debug | info | notice | warn | error | crit |debug_core | debug_alloc | debug_mutex | debug_event | debug_http |debug_imap];其中分为六个等级--debug--info--notice--warn--error--crit--自左至右日志信息输出越来越少,级别越来越高debug-core -- 当ngin 阅读全文
posted @ 2014-02-12 22:48 silence.li 阅读(395) 评论(0) 推荐(0)
摘要:在nginx.conf中将access_log /dev/null;error_log /dev/null; 阅读全文
posted @ 2014-01-02 18:01 silence.li 阅读(317) 评论(2) 推荐(0)