nginx中error_page没有生效(nginx+passenger+rails)
应用部署方式为 nginx + passenger + rails
当我想要用nginx来默认处理400以上状态时,发现在rails返回respose之后,nginx不会再次执行error_page(官方介绍该directive在proxy返回response依然会执行),原因在于需要配置 passenger_intercept_errors on ;
nginx.conf 中 server 配置:
server {
listen 3443 ssl;
server_name XXX;
ssl_certificate /root/ssl/server.crt;
ssl_certificate_key /root/ssl/server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5; root /var/ror/cas/public; passenger_enabled on;
passenger_intercept_errors on; #问题根源
passenger_ruby /usr/local/rvm/gems/ruby-2.3.0/wrappers/ruby; access_log /var/ror/logs/access.log;
error_log /var/ror/logs/error.log debug; # redirect server error pages to the static page /40x.html
error_page 404 /404.html;
location = /404.html {
}
error_page 403 = /403.html;
location = /403.html {
} # redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
参考: https://www.phusionpassenger.com/documentation/Users%20guide%20Nginx.html#passenger_intercept_errors
nginx中error_page没有生效(nginx+passenger+rails)的更多相关文章
- Nginx中文文档-安装 Nginx
nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息. 正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好. ububtu平台编译环 ...
- lnmp 在nginx中配置相应的错误页面error_page
1. 创建自己的404.html页面 2.更改nginx.conf在http定义区域加入: fastcgi_intercept_errors on; 3.更改nginx.conf(或单独网站配置文件, ...
- nginx中配置404错误页面的教程
什么是404页面如果网站出了问题,或者用户试图访问一个并不存在的页面时,此时服务器会返回代码为404的错误信息,此时对应页面就是404页面.404页面的默认内容和具体的服务器有关.如果后台用的是NGI ...
- nginx基本配置与参数说明以及Nginx中的upstream轮询机制介绍
转自:http://blog.csdn.net/happydream_c/article/details/54943802 一.nginx简介 Nginx (发音为[engine x])专为性能优化而 ...
- Nginx中防盗链(下载防盗链和图片防盗链)操作记录
日常运维工作中,设置防盗链的需求会经常碰到,这也是优化网站的一个必要措施.今天在此介绍Nginx中设置下载防盗链和图片防盗链的操作~ 一.Nginx中下载防盗链的操作记录对于一些站点上的下载操作,有很 ...
- CentOS6.4 安装OpenResty和Redis 并在Nginx中利用lua简单读取Redis数据
1.下载OpenResty和Redis OpenResty下载地址:wget http://openresty.org/download/ngx_openresty-1.4.3.6.tar.gz Re ...
- nginx中使用srcache_nginx模块构建缓存
nginx中可以将lua嵌,让nginx执行lua脚本,可以处理高并发,非阻塞的处理各种请求,openresty项目中可以使用nignx可以直接构建 srcache_nginx + redis 缓存, ...
- Nginx中502和504错误详解
在使用Nginx时,经常会碰到502 Bad Gateway和504 Gateway Time-out错误,下面以Nginx+PHP-FPM来分析下这两种常见错误的原因和解决方案. 1.502 Bad ...
- Nginx中防盗链(下载防盗链和图片防盗链)及图片访问地址操作记录
日常运维工作中,设置防盗链的需求会经常碰到,这也是优化网站的一个必要措施.今天在此介绍Nginx中设置下载防盗链和图片防盗链的操作~ 一.Nginx中下载防盗链的操作记录对于一些站点上的下载操作,有很 ...
随机推荐
- [LeetCode] Nested List Weight Sum 嵌套链表权重和
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. ...
- [LeetCode] Invert Binary Tree 翻转二叉树
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem wa ...
- [LeetCode] Min Stack 最小栈
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. pu ...
- redis慢查询日志
运维需要记录一下主redis中那些“慢操作”的命令,然后找到相关的业务方,不然的话,阻塞 就不好玩了.然后就直接在redis手册中就找到了相关的命令. SLOWLOG subcommand [argu ...
- BPM问题
1.安装XFormDesigner后编辑界面报错 解决方法:
- 远程桌面时plsql的复制粘贴功能失效
解决办法:重新启动远程桌面上的rdpclip进程就可以复制粘贴了,但是每次重开远程桌面都会出现同样的问题.可以rdpclip这个设置成开机启动.
- Redux原理(一):Store实现分析
写在前面 写React也有段时间了,一直也是用Redux管理数据流,最近正好有时间分析下源码,一方面希望对Redux有一些理论上的认识:另一方面也学习下框架编程的思维方式. Redux如何管理stat ...
- Mysql主从架构的复制
复制类型 (1)基于语句的复制: 在主服务器上执行的SQL语句,在从服务器上执行同样的语句.MySQL默认采用基于语句的复制,效率比较高. 一旦发现没法精确复制时,会自动选着基于行的复制. (2) ...
- Scala元组
object TupleTest { def basic(firstName: String, lastName: String, age: Int): (String, String, Int) = ...
- HDU 4081Qin Shi Huang's National Road System(次小生成树)
题目大意: 有n个城市,秦始皇要修用n-1条路把它们连起来,要求从任一点出发,都可以到达其它的任意点.秦始皇希望这所有n-1条路长度之和最短.然后徐福突然有冒出来,说是他有魔法,可以不用人力.财力就变 ...