Welcome! Log In Create A New Profile

Advanced

custom 403 by deny rule

Posted by LuisManson 
custom 403 by deny rule
April 02, 2013 05:10PM
Hello, i want to show a custom 403 for "deny" requests, since i have two places where a 403 can be shown, one is any IP from a list and the other one is when there is a PHP request in a forbidden directory

IE: show no-php403.html if the request is catched by the first (or any?) case and no-spammers-CN.html if they are catched by its IP

is this possible?



my-site.conf
------------------------------------------------------------------------------------------------------------------------------------------------------------
location ~* ^/(?:cache|uploads)/.*\.(?:pl|php[345]*)$ {
access_log off;
log_not_found off;
return 403; # or 404/403
}



-------------------
custom-deny.conf (included inside all vhosts)
------------------------------------------------------------------------------------------------------------------------------------------------------------
deny 182.136.0.0/16;
error_page 403 /error403.html;

location = /error403.html {
access_log /var/log/nginx/error_403.log;
root /usr/share/nginx/html;
allow all;
ssi on;
}


Thanks!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready