title: How can I set REMOTE_ADDR in apache before php is invoked?
body: <p>I have a website set up with nginx acting as a reverse proxy to apache 2.2, which is running php.  From apache and php's perspective the IP address of all requests is the nginx server.  I'd like php to see the same remote IP that nginx sees.</p>
  <p>Nginx sets a header X-Real-IP which contains the remote IP that nginx sees.  I tried doing something like this in the apache conf:</p>
  <pre><code>SetEnvIf ^X-Real-IP$ &quot;(.+)&quot; REMOTE_ADDR=$1
  </code></pre>
  <p>My hope was that I could set the REMOTE_ADDR environment variable and when php finally gets invoked, it would see the remote IP that nginx sees.  I think the php code is doing this:</p>
  <pre><code>$_SERVER['REMOTE_ADDR']
  </code></pre>
  <p>Anyway, this isn't working. Can you not set REMOTE_ADDR in the apache config file?</p>