Hi. I’d want to secure some locations with basic GeoIP like this:
/etc/nginx/sites-enabled/default_server
upstream error {
server localhost:9222;
}
server {
root /var/www/htdocs;
server_name 10.10.10.10;
listen 80;
include /etc/nginx/fastcgi_php;
location / {
index index.php;
}
error_page 403 /403.html;
location = /403.html {
root /var/www/nginx-default;
}
location ^~ /test {
index index.php;
if ($geoip_country_code = AR) {
fastcgi_pass unix:/var/run/www/php.sock;
}
if ($geoip_country_code != AR) {
fastcgi_pass error;
return 403;
}
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}
}
It’s working but images are not displaying. If I switch my location to
^~ /test.php$ my GeoIP stops working.
Any suggestions?
Thanks