Convert .htaccess to nginx.conf

hello family could help me convert this .htaccess to nginx:

RewriteEngine On
RewriteCond% {REQUEST_FILENAME}! -D
RewriteCond% {REQUEST_FILENAME}! -F
RewriteRule ^ admin /(.*)?$ admin / index.php? A = $ 1 [QSA, NC, L]
RewriteRule ^ sitemap.xml $ sitemap.php
RewriteCond% {REQUEST_FILENAME}! -D
RewriteCond% {REQUEST_FILENAME}! -F
RewriteRule ^ (. *)? $ Index.php? A = $ 1 [QSA, NC, L]

ErrorDocument 404 /index.php?a=404

I tried and gave me this result but it is not working:

error_page 404 /index.php?a=404;

location / {
if (! -e $ request_filename) {
rewrite ^ / admin /(.*)?$ /admin/index.php?a=$1 break;
}
if (! -e $ request_filename) {
rewrite ^ / (. *)? $ /index.php?a=$1 break;
}
}

location = /sitemap.xml {
rewrite ^ (. *) $ /sitemap.php;
}

Does any of the numerous links found via

google convert .htaccess to nginx

help?

not working

I converted (https://winginx.com/en/htaccess) it and put it in my nginx.conf and it doesn't work

https://pastebin.com/raw/6pDHbbus