Help with apache rewrite rule to nginx

Hello, would like to convert the below rule from Apache to nginx, but to
be honest I have no clue how.

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} gallery_remote2.php
RewriteCond %{REQUEST_URI} !/main.php$
RewriteRule . - [L]

Please if someone knows, please let me know, thank you!