简体   繁体   中英

Nginx custom 403 page not working

Trying to add a custom page for my website, but for whatever reason, no matter what I change it to, it doesn't work. Whenever I change the 404, it works fine.

error_page 403 /blocked.php;
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;

The 403 page always returns the default nginx page regardless of what I change it to.

Try

proxy_intercept_errors on;

Before "error_page" directives: This directive allows nginx to recognize the error code being returned from Apache and run its own directives to display the right page.

Try

error_page 403 = /blocked.php;

Here's the reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM