40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
# Global restrictions configuration file.
|
|
# Designed to be included in any server {} block.
|
|
location = /favicon.ico {
|
|
log_not_found off;
|
|
access_log off;
|
|
}
|
|
# robots.txt fallback to index.php
|
|
location = /robots.txt {
|
|
# Some WordPress plugin gererate robots.txt file
|
|
allow all;
|
|
try_files $uri $uri/ /index.php?$args @robots;
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
# additional fallback if robots.txt doesn't exist
|
|
location @robots {
|
|
return 200 "User-agent: *\nDisallow: /wp-admin/\nAllow: /wp-admin/admin-ajax.php\n";
|
|
}
|
|
|
|
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac) excepted .well-known directory.
|
|
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
|
|
location ~ /\.(?!well-known\/) {
|
|
deny all;
|
|
}
|
|
|
|
# Deny access to any files with a .php extension in the uploads directory for the single site
|
|
location /wp-content/uploads {
|
|
location ~ \.php$ {
|
|
deny all;
|
|
}
|
|
}
|
|
|
|
|
|
# Deny access to any files with a .php extension in the uploads directory
|
|
# Works in sub-directory installs and also in multisite network
|
|
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
|
|
location ~* /(?:uploads|files)/.*\.php$ {
|
|
deny all;
|
|
}
|