【发布时间】:2018-07-15 01:42:57
【问题描述】:
我正在使用 nginx 的 $geoip_country_code 模块根据 IP 重定向用户。我的配置代码如下-
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)$ { }
}
想法是根据我已本地化的国家/地区重定向用户,否则用户将转到默认索引,即其他所有人的通用索引。当我在我的国家/地区的浏览器中打开它时,它可以完美运行,因为我已经对其进行了本地化。但是当从不同的国家打开时,它会显示内部服务器错误。它不会进入默认索引页面。
有人可以指出我做错了什么吗?
【问题讨论】:
-
发布您在 nginx 访问/错误日志中看到的日志
标签: nginx devops nginx-location nginx-reverse-proxy