0

I'm unable to display my custom 50x.html page, instead I'm getting nginx error output.

location ~ \.php$ {
    root /legacy/app;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_read_timeout 10s;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    fastcgi_intercept_errors off;
    fastcgi_buffer_size 16k;
    fastcgi_buffers 4 16k;

    # make sure you have a custom html page placed in app folder
    # i.e. /legacy/app/app/50x.html
    error_page   500 502 503 504  /legacy/app/50x.html;

}

location / {
    try_files _ /index.php?$query_string;

    # make sure you have a custom html page placed in app folder
    # i.e. /legacy/app/app/50x.html
    error_page   500 502 503 504  /legacy/app/50x.html;
}

in nginx logs:

172.17.0.1 - - [28/Oct/2022:22:21:54 +0000] 504 "GET /test33 HTTP/1.1" 569 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36" "-"
2022/10/28 22:25:12 [error] 54#54: *20 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.17.0.1, server: localhost, request: "GET /test33 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8080"

and in the browser:

➜ curl http://localhost:8080/test33                                                                                             
<html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.20.1</center>
</body>
</html>

I tried to change fastcgi_intercept_errors off; to fastcgi_intercept_errors on; but it has no effect.

DmitrySemenov
  • 9,204
  • 15
  • 76
  • 121

0 Answers0