There are many problems in your code, please move all UNA related rules to "location /" block. Also you need to remove "try_files" rules.
Thanks for the advice. i believe i have to have the "try_files" rules because I am using php-fpm instead of FastCGI. However I will try moving the rewrite rules.