Welcome! Log In Create A New Profile

Advanced

How to set custom 500 error page when get: rewrite or internal redirection cycle while internally redirecting to

Posted by scriptracer 
Example nginx config /etc/nginx/conf.d/errorpagestest.conf

server {
listen 80;
server_name errorstage.test;
error_log /var/log/nginx/errorstage.log warn;
access_log /var/log/nginx/errorstage-access.log custom;

root /var/www/errorpagestest;
try_files $uri $uri/ /dir/index.html;

error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 /500.html;
error_page 502 /502.html;
error_page 503 /503.html;
error_page 504 /504.html;
}

case 1: If remove/comment line "try_files $uri $uri/ /dir/index.html;" and try get any nonexistent file, i get load my custom 404 error page file /var/www/errorpagestest/404.html

case 2: If file /var/www/errorpagestest/dir/index.html exist, when i try get any nonexistent file, i get load file /var/www/errorpagestest/dir/index.html

case 3: If i try get any nonexistent file when file /var/www/errorpagestest/dir/index.html not exist, i get nginx 500 error page with record in /var/log/nginx/errorstage.log: [error] 21996#21996: *401019 rewrite or internal redirection cycle while internally redirecting to "/dir/index.html", server: errorstage.test, request: "GET /anyfile HTTP/1.1", host: "errorstage.test"

But i need get my custom 500 error page in case 3. How it solved?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 66
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready