You've already forked nginxsnippets
initial commit
This commit is contained in:
55
wphardening.conf
Normal file
55
wphardening.conf
Normal file
@@ -0,0 +1,55 @@
|
||||
# Wordpress deny xmlrpc start #####################################################################################################
|
||||
location = /xmlrpc.php {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
return 444;
|
||||
}
|
||||
# Wordpress deny xmlrpc stop ######################################################################################################
|
||||
|
||||
# Wordpress deny wp-cron start ####################################################################################################
|
||||
location = /wp-cron.php {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
return 444;
|
||||
}
|
||||
# Wordpress deny wp-cron stop #####################################################################################################
|
||||
|
||||
# Wordpress limit get post start ##################################################################################################
|
||||
if ($request_method !~ ^(GET|POST)$ ) {
|
||||
return 444;
|
||||
}
|
||||
# Wordpress limit get post stop ###################################################################################################
|
||||
|
||||
# Wordpress deny php files where they dont belong start ###########################################################################
|
||||
location ~* /(?:uploads|files|wp-content|wp-includes)/.*.php$ {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
return 444;
|
||||
}
|
||||
# Wordpress deny php files where they dont belong stop ############################################################################
|
||||
|
||||
# Wordpress limit request pr. sec here its 5 req/sec start ########################################################################
|
||||
location = /wp-login.php {
|
||||
limit_req zone=RATELIMIT burst=3 nodelay;
|
||||
limit_req_status 444;
|
||||
include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/var/run/php/phpVERSION-fpm.sock;
|
||||
}
|
||||
# NOTE: The above requires the following file to exist:
|
||||
# /etc/nginx/conf.d/rate-limit.conf with the following content:
|
||||
# limit_req_zone $binary_remote_addr zone=RATELIMIT:10m rate=10r/s;
|
||||
# Wordpress limit request pr. sec here its 5 req/sec stop #########################################################################
|
||||
|
||||
# Wordpress deny access to the following files in upload directory start ##########################################################
|
||||
location ~* ^/wp-content/uploads/.*.(html|htm|shtml|php|js|swf)$ {
|
||||
deny all;
|
||||
}
|
||||
# Wordpress deny access to the following files in upload directory stop ###########################################################
|
||||
|
||||
# Wordpress dont cache certain pages start ########################################################################################
|
||||
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") { set $skip_cache 1; }
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { set $skip_cache 1; }
|
||||
# Wordpress dont cache certain pages stop #########################################################################################
|
Reference in New Issue
Block a user