I am using $geoip_country_code module of nginx to redirect user based on IP. My config code is as given below-
server {
listen 80;
gzip on;
server_name example.com;
root html/example;
location / {
index index.html;
try_files /$geoip_country_code/index.html /index.html;
}
location ~* \.(gif|jpg|jpeg|png|js|css)$ { }
}
Idea is to redirect the user based on country for which I have localised otherwise the user goes to default index i.e generic for everyone else. It works perfectly when opened in browser from my country as I have localised for it. But when opened from a different country it shows internal server error. Its not going to default index page.
Can someone point me what am I doing wrong?