我最近开始学习NGINX并遇到了一些问题。即使我已经使用error_page指令配置了NGINX(1.4.6),我仍然得到并且错误500。如果我尝试不从第二个上游服务器发送错误500,配置工作(我按预期得到woops.html)。这是我的配置文件:
server {
listen 80 default_server;
root /srv/www;
index index.html index.htm;
server_name test.dev;
location / {
proxy_pass http://localhost:8080;
proxy_intercept_errors on;
error_page 500 @retry;
}
location @retry {
proxy_pass http://localhost:8081;
proxy_intercept_errors on;
error_page 500 /woops.html;
}
location = /woops.html {
root /srv/www;
}
}
server {
listen 8080;
listen localhost:8080;
server_name localhost;
root /srv/www;
location / {
return 500;
}
}
server {
listen 8081;
listen localhost:8081;
server_name localhost;
root /srv/www/app;
location / {
return 500;
}
}