Welcome! Log In Create A New Profile

Advanced

geoip+php

batistuta
February 16, 2012 12:56PM
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. :D

Any suggestions?
Thanks_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

geoip+php

batistuta February 16, 2012 12:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 168
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready