geoip+php

batistuta batistuta.ar at hush.com
Thu Feb 16 17:55:36 UTC 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120216/d0e802ca/attachment.html>


More information about the nginx mailing list