'Convert http rewrite rules from Apache to Nginx

I'm trying to set up redirect web traffic for a wordpress site based on Country of Origin with CloudFront in Nginx. But having trouble to convert these rewrite rules to nginx:

RewriteCond %{REQUEST_URI} ^/content/retail.html
RewriteCond %{HTTP:CLOUDFRONT-VIEWER-COUNTRY} ^US$
RewriteRule ^.*$ https://test.example.com/content/retail/us/en.html [R=302,L]

Can I get the above rules written in Nginx configuration ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source