Nginx multiple conditions in if statement

Solution 1:

One best-practice way to do this is with location blocks which refuse requests for PHP files.

For example:

server {
  location /vb_attach {
    location ~ \.php$ {return 403;}
  }

  location /vb_album {
    location ~ \.php$ {return 403;}
  }

  location ~ \.php {
    ...
  }
}

The nginx wiki has several alternatives for preventing this particular security issue which you may find useful in other circumstances as well.