Protect WordPress PDF uploads on nginx
<p>I'm looking to protect WordPress PDF uploads, and restrict their access to users who meet a certain cookie requirement. These users are <strong>not necessarily logged in</strong>, instead we check for certain data in their saved cookies.</p>

<p>I found this article for Apache: <a href="http://0to5.com/protecting-wordpress-media-uploads-unless-user-is-logged-in/" rel="nofollow noreferrer">http://0to5.com/protecting-wordpress-media-uploads-unless-user-is-logged-in/</a></p>

<p>It describes how you can execute your own PHP when accessing media. How would I translate that into nginx? Or is there a better way to do restrict PDF access on nginx?</p>