zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    idea--不能启动问题
    linux--mysql5.7安装
    vmware
    debezium
    java枚举
    springfox
    日志级别
    lombok--知识点
    es6--箭头函数
    网址访问过慢
  • 原文地址:https://www.cnblogs.com/zhangyanpei/p/5946182.html
Copyright © 2011-2022 走看看