Joby Elliott
2a5b05b320
Simplify the error page handling and configuration by refactoring the code. Removed the unnecessary error message "IP banned for bad behavior" and replaced it with a generic 403 error response. Also, added new error pages for 404, 503, and 50x errors. The error pages are now stored in the /var/www/error-pages directory. Updated the nginx configuration to use the new error pages and added PHP handling for the error pages.
58 lines
1.4 KiB
Text
58 lines
1.4 KiB
Text
# Global error pages
|
|
error_page 403 /403.html;
|
|
error_page 404 /404.html;
|
|
error_page 500 502 504 /50x.html;
|
|
error_page 503 /503.html;
|
|
|
|
# Global error handler locations
|
|
location = /403.html {
|
|
internal;
|
|
try_files
|
|
$document_root/403.php
|
|
$document_root/403.html
|
|
/var/www/error-pages/403.php
|
|
/var/www/error-pages/403.html
|
|
=403;
|
|
fastcgi_intercept_errors on;
|
|
}
|
|
|
|
location = /404.html {
|
|
internal;
|
|
try_files
|
|
$document_root/404.php
|
|
$document_root/404.html
|
|
/var/www/error-pages/404.php
|
|
/var/www/error-pages/404.html
|
|
=404;
|
|
fastcgi_intercept_errors on;
|
|
}
|
|
|
|
location = /503.html {
|
|
internal;
|
|
try_files
|
|
$document_root/503.php
|
|
$document_root/503.html
|
|
/var/www/error-pages/503.php
|
|
/var/www/error-pages/503.html
|
|
=503;
|
|
fastcgi_intercept_errors on;
|
|
}
|
|
|
|
location = /50x.html {
|
|
internal;
|
|
try_files
|
|
$document_root/50x.php
|
|
$document_root/50x.html
|
|
/var/www/error-pages/50x.php
|
|
/var/www/error-pages/50x.html
|
|
=500;
|
|
fastcgi_intercept_errors on;
|
|
}
|
|
|
|
# PHP handling for error pages
|
|
location ~ ^/(?:403|404|503|50x)\.php$ {
|
|
internal;
|
|
include fastcgi_params;
|
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
|
fastcgi_pass unix:/var/run/php/php-fpm.sock; # Adjust this path as needed
|
|
}
|