WordPress nginx configuration
# Serve index.html before index.php if it exists
index index.html index.php;
# Protection against XMLRPC brute force attacks
location ~ ^/xmlrpc.php {
# drop and close connection
return 444;
}
# Don't log failed requests for these files
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Don't serve PHP files located in these directories
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~* /wp-content/.*\.php$ {
deny all;
}
location ~* /wp-includes/.*\.php$ {
deny all;
}
location ~* /(?:uploads|files|wp-content|wp-includes)/.*\.php$ {
deny all;
}
# WordPress rewrite rules
location / {
try_files $uri $uri/ /index.php?$args;
}