nginx: [emerg] "proxy_cache_path" directive is not allowed here..

由于需要解决nginx + tomcat 导致session丢失的问题,使用了proxy_cookie_path,但不幸的是总是出现上述错误。我当初是用yum -y remove nginx CentOS release 6.5 (Final)下安装的,执行nginx -v 发现版本为:nginx version: nginx/1.0.15。而当时(20151)的稳定版本是nginx-1.6.2 ,所以决定换它来试试。

先执行yum -y remove nginx  ,卸载了原先安装的nginx/1.0.15。然后按照如下两个文档进行编译安装即可:

http://blog.aboutc.net/nginx/62/compile-and-install-nginx-on-linux

http://www.jb51.net/article/49479.htm

 

结论:

  1. 该错误应该是版本太低造成的
  2. configure脚本中无需添加--with-http_proxy_module 或者--with-http_rewrite_module,实际证明nginx-1.6.2 本身就支持,加了反而在出错,如 ./configure: error: invalid option "--with-http_rewrite_module" 

 

 

相关参考:

 

官网:http://nginx.org/

扫描二维码关注公众号,回复: 523434 查看本文章

nginx + tomcat 导致session丢失的问题:http://www.thinksaas.cn/group/topic/277531/

centos下编译安装nginx|configure参数对照列表:http://www.cnblogs.com/y0umer/archive/2013/04/28/3050158.html 

nginx启动,重启,关闭命令:http://www.cnblogs.com/derekchen/archive/2011/02/17/1957209.html

猜你喜欢

转载自sunfish.iteye.com/blog/2173096