![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ngnix
文章平均质量分 53
iteye_17913
这个作者很懒,什么都没留下…
展开
-
nginx根据http请求头中的accept-language转发到不同的页面
直接上代码 if ($http_accept_language ~* ^zh){ set $lang "/index_cn.jsp";}if ($http_accept_language !~* ^zh){ set $lang "/index_en.jsp"; } location =/ { ...2014-02-14 15:54:50 · 958 阅读 · 0 评论 -
nginx操作cookie使测试IP不写入access.log
开发者常常有这样的需求,测试的IP或者站长的IP不要写入nginx的access.log中,这样会影响日志阅读的质量。读者第一个想法就是在nginx.conf中配置,如果测试IP和站长的IP不写入access.log,但是常常有这样的情况,比如博主的公司有一个IP池,博主自己也搞不清有多少IP,这样就无法设置通过IP来控制日志。博主想了一个方法,在站长的浏览器端种下cookie,如果nginx...2014-02-19 13:40:58 · 96 阅读 · 0 评论 -
设置nginx让baidu,google等爬虫抓取不同语言的页面
很多网站都有多语言版本,站长往往希望baidu爬虫爬中文页面,而google爬虫爬英文页面。于是,如果网站如以nginx做前端的话,站长往往会在nginx.conf中设置http头的accept-language,让爬虫重定向到指定语言页面进行抓取。但是事与愿违,google和baidu爬虫不设置http头的accept-language,导致爬虫抓取的是web.xml指定的默认页面。这样,b...原创 2014-02-22 13:10:18 · 450 阅读 · 0 评论