Reputation: 5129
This is what I use to do a proxy_pass:
location ~* \.php$ {
proxy_pass http://127.0.0.1:8080;
}
After this $_SERVER['REMOTE_ADDR'] is no longer available in php. What do I need to do to have these $_SERVER variables available in php after nginx passes request to Apache?
Upvotes: 1
Views: 1764
Reputation: 12785
You need to have mod_rpaf installed in Apache and in Nginx, add the following:
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
Upvotes: 2