wordpress-multi.conf.hbs 765 B

1234567891011121314151617181920212223242526
  1. # Deny access to any files with a .php extension in the files directory
  2. # Works in sub-directory installs and also in multisite network
  3. # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
  4. location ~* /(?:files)/.*\.php$ {
  5. deny all;
  6. }
  7. location ~ ^/([^/]+/)?files/(.+) {
  8. try_files /wp-content/blogs.dir/0/files/$2 /wp-includes/ms-files.php?file=$2;
  9. access_log off;
  10. log_not_found off;
  11. expires 5m;
  12. }
  13. if (!-e $request_filename) {
  14. rewrite /wp-admin$ $resolved_scheme://$host$uri/ permanent;
  15. rewrite ^(/[^/]+)?(/wp-.*) $2 last;
  16. rewrite ^(/[^/]+)?(/.*\.php) $2 last;
  17. }
  18. location / {
  19. try_files $uri $uri/ /index.php$is_args$args;
  20. }
  21. # Add trailing slash to */wp-admin requests.
  22. rewrite ^(.*)(wp-admin)$ $1$2/ permanent;