I have already this following configuration of Lighttpd.
alias.url += ( "/ui/" => "/usr/local/opnsense/www/" )
alias.url += ( "/api/" => "/usr/local/opnsense/www/" )
url.rewrite-if-not-file = ( "^/ui/([^\?]+)(\?(.*))?" => "/ui/index.php?_url=/$1&$3" ,
"^/api/([^\?]+)(\?(.*))?" => "/api/api.php?_url=/$1&$3"
)
I want to change this config into nginx .