我有一个由 Unicorn 托管的 Sinatra 应用程序,前面是 nginx。当 Sinatra 应用程序出错(返回 500)时,我想提供一个静态页面,而不是默认的“内部服务器错误”。我有以下 nginx 配置:
server {
listen 80 default;
server_name *.example.com;
root /home/deploy/www-frontend/current/public;
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 5;
proxy_read_timeout 240;
proxy_pass http://127.0.0.1:4701/;
}
error_page 500 502 503 504 /50x.html;
}
error_page 指令在那里,我将 sudo 设置为 www-data (Ubuntu) 并验证我可以cat
使用该文件,因此这不是权限问题。使用上面的配置文件,service nginx reload
我收到的错误页面仍然是相同的“内部服务器错误”。
我的错误是什么?