Search code examples
apachenginxcode-conversion

Convert Apache command to nginx (FilesMatch)


How to block viewing certain types of files through a browser to configure Nginx?

<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

Solution

  • This is the NginX version:

    location ~ \.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$ {
      deny all;
    }