2014-09-07 22:51:34 +03:00
|
|
|
|
|
|
|
# try for WordPress index.php in /
|
2016-04-25 12:33:12 +03:00
|
|
|
# fall back to index.php + args (passed to php-fpm later)
|
2016-10-18 21:41:46 -04:00
|
|
|
# also serves static files from the disk instead of passing to interpreter.
|
2014-09-07 22:51:34 +03:00
|
|
|
location / {
|
|
|
|
try_files $uri $uri/ /index.php?$args;
|
2016-11-20 17:22:47 +02:00
|
|
|
|
|
|
|
{% if enable_hsts == True %}
|
|
|
|
# Enable this if you want HSTS (recommended, but be careful)
|
|
|
|
# Include all subdomains and indicate to Google that we want this pre-loaded in Chrome's HSTS store
|
|
|
|
# See: https://hstspreload.appspot.com/
|
2021-03-23 15:36:28 +02:00
|
|
|
add_header Strict-Transport-Security "max-age={{ nginx_hsts_max_age }}; includeSubDomains; preload" always;
|
2016-11-20 17:22:47 +02:00
|
|
|
{% endif %}
|
2014-09-07 22:51:34 +03:00
|
|
|
}
|
|
|
|
|
2016-03-12 19:17:40 +02:00
|
|
|
location ~* \.(?:ico|css|js|gif|jpe?g|png|svg)$ {
|
2016-11-14 07:58:46 +02:00
|
|
|
add_header Cache-Control "max-age=604800";
|
2016-11-20 17:22:47 +02:00
|
|
|
|
|
|
|
{% if enable_hsts == True %}
|
|
|
|
# Enable this if you want HSTS (recommended, but be careful)
|
|
|
|
# Include all subdomains and indicate to Google that we want this pre-loaded in Chrome's HSTS store
|
|
|
|
# See: https://hstspreload.appspot.com/
|
2021-03-23 15:36:28 +02:00
|
|
|
add_header Strict-Transport-Security "max-age={{ nginx_hsts_max_age }}; includeSubDomains; preload" always;
|
2016-11-20 17:22:47 +02:00
|
|
|
{% endif %}
|
2014-10-10 11:05:42 +03:00
|
|
|
}
|
|
|
|
|
2014-09-07 22:51:34 +03:00
|
|
|
# Add trailing slash to */wp-admin requests.
|
|
|
|
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
|
|
|
|
|
2015-02-26 17:05:50 +03:00
|
|
|
# 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;
|
|
|
|
}
|
|
|
|
|