nginx 역방향 프 록 시 에 사용자 정의 오류 페이지 설정

1458 단어 nginx
만약 우리 의 nginx 가 역방향 대 리 를 설정 했다 면 다음 과 같 습 니 다.
location ^~ /wyq/ {
			proxy_pass    https://127.0.0.1:$wyq_port;
			proxy_redirect https://127.0.0.1:$wyq_port/ /;
			#proxy_redirect off;
			proxy_set_header Host $host;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header X-Forwarded-Proto https;
		}

즉, URL 이 wyq 와 일치 할 때 로 컬 포트 $wyq 로 대 리 됩 니 다.port 서비스 로 갑 니 다.
지금 $wyqport 서비스 가 시작 되 지 않 았 습 니 다. 브 라 우 저 요청 시 돌아 갑 니 다. internal server error 의 오류,
오류 페이지 를 사용자 정의 하려 면 다음 설정 으로 바 꾸 면 됩 니 다.
location ^~ /wyq/ {
			proxy_pass    https://127.0.0.1:$wyq_port;
			proxy_redirect https://127.0.0.1:$wyq_port/ /;
			#proxy_redirect off;
			proxy_set_header Host $host;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header X-Forwarded-Proto https;    
                        proxy_intercept_errors on;
			error_page 500 502 503 504 = /error_500.html;
}
location = /error_500.html{
			root /var/web;
}
 
  
 
  
 
  
 
  
 
  
 
  
 
  
 
  
 
  
 
 

좋은 웹페이지 즐겨찾기