title: Allowing only local network access in NGINX
body: <p>I have a single physical server running several <code>server</code> blocks in nginx corresponding to different subdomains. One of them I'd like to be only accessible from devices on the same local network as the server. I know theoretically this can be done with </p>
  
  <pre><code>allow 192.168.1.0/24;
  deny all;
  </code></pre>
  
  <p>within a <code>location</code> block. When I actually try to access the server from a local device, though, the request is denied. Looking at the access logs, this is because the request is shown as coming from my network's external IP rather than the device's internal IP. How can I fix this?</p>