I'm using Nginx reverse proxy to apache2 using following tutorial.
Then i try to install geoip to Nginx using this tutorial
The reverse proxy works flawlessly for a while now, until I tried to install the geoip database so I can get the country code on PHP.
I have the following on nginx configured as what the tutorial instructed.
location ~ \.php$ {
# location / {
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#include snippets/fastcgi-php.conf;
proxy_pass http://1.2.3.4:8080$request_uri;
proxy_set_header Host $host;
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;
proxy_set_header GEOIP_COUNTRY_CODE $geoip_country_code;
proxy_set_header GEOIP_COUNTRY_CODE3 $geoip_country_code3;
proxy_set_header GEOIP_COUNTRY_NAME $geoip_country_name;
proxy_set_header GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
proxy_set_header GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
proxy_set_header GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
proxy_set_header GEOIP_REGION $geoip_region;
proxy_set_header GEOIP_CITY $geoip_city;
proxy_set_header GEOIP_POSTAL_CODE $geoip_postal_code;
proxy_set_header GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
proxy_set_header GEOIP_LATITUDE $geoip_latitude;
proxy_set_header GEOIP_LONGITUDE $geoip_longitude;
include /etc/nginx/proxy_params;
}
If i use proxy_pass to apache2, the GEOIP variables are **all not shown in phpinfo.
If I use nginx fastcgi_pass directly (turning off reverse proxy to apache) i can get the environment variables set and they are reflected in the phpinfo.
It appears that proxy_set_header may not be working as apache doesn't seems to be reading it.
What do I have to do so apache can get all the variables?