꼬반 Blog

[NGINX] Reverse Proxy 설정 시 Nginx 에서 Error Page 설정

참고 : http://serverfault.com/questions/511109/nginx-local-fallback-error-page-if-proxy-destination-is-unavailable Nginx 에서 리버스 프록시 설정을 하여 사용할때 에러 페이지의 경우는 Nginx 설정이 아닌 프록시 서버의 설정을 따르게 된다. (Nginx - Tomcat 설정인 경우 Tomcat 에러 페이지가 노출) 이때 Nginx 에서 에러 페이지를 설정하기 위해서는 아래의 옵션을 함께 사용하면 된다. (Server 블록 내에서 사용) server { ... location / { proxy_intercept_errors on; proxy_pass http://localhost:8080/; } error_page..

Read More

[NGINX] Reverse Proxy 설정 시 Nginx 에서 Error Page 설정

참고 : http://serverfault.com/questions/511109/nginx-local-fallback-error-page-if-proxy-destination-is-unavailable


Nginx 에서 리버스 프록시 설정을 하여 사용할때 에러 페이지의 경우는 Nginx 설정이 아닌


프록시 서버의 설정을 따르게 된다. (Nginx - Tomcat 설정인 경우 Tomcat 에러 페이지가 노출)


이때 Nginx 에서 에러 페이지를 설정하기 위해서는 아래의 옵션을 함께 사용하면 된다.


(Server 블록 내에서 사용)



server {

...

  location / {

    proxy_intercept_errors on;

    proxy_pass http://localhost:8080/;

  }

  error_page 404 500 502 503 504 /custom_error.html;

  location = /custom_error.html {

    root /usr/share/nginx/html;

    internal;

  }

...

}

반응형

Article By 꼬반

*certificate* : VCP 5(2012), RHCSA 7 (2014), RHCE 7 (2015), RHCSA in REDHAT OpenStack(2017) *development language* : Javascript, NodeJS, Golang, html5, css3, shell script *middle ware* : NGINX, Apache, Tomcat, Docker, Docker Swarm, Mesos, Kubernetes, HCI,

Discuss about post