Skip to content

Instantly share code, notes, and snippets.

@olkitu
Created March 7, 2019 21:10
Show Gist options
  • Save olkitu/2af66d81dc9ac8d330d2ce52346bbab3 to your computer and use it in GitHub Desktop.
Save olkitu/2af66d81dc9ac8d330d2ce52346bbab3 to your computer and use it in GitHub Desktop.
Block accessto WordPress directory and files
location = ~* /xmlrpc.php {
deny all;
access_log off;
log_not_found off;
}
location = ~* /wp-config.php {
deny all;
log_not_found off;
}
location ~* /wp-includes/.*.php$ {
deny all;
access_log off;
log_not_found off;
}
location ~* /wp-content/.*.php$ {
deny all;
access_log off;
log_not_found off;
}
location ~* /(?:uploads|files)/.*.php$ {
deny all;
access_log off;
log_not_found off;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment