V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
Lyrical
V2EX  ›  NGINX

Nginx 中如何放行一个网页

  •  
  •   Lyrical · 2019-01-19 17:41:25 +08:00 · 1760 次点击
    这是一个创建于 1914 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在以下场景中,如何在 nginx 中放行一个网页?

    网站使用的是 cloudflare 的 CDN,在 nginx 中屏蔽了所有来自国内的 IP 地址

    在 http 段中添加

    map $http_cf_ipcountry $allow {

    default yes;

    CN no;

    }

    然后在 server 段中添加

    if ($allow = no) {

    return 403;

    }

    这样,所有来自国外的 IP 访问网站页面的时候全都返回 403 了。

    但是我现在有这样一个需求,就是在网站中,有一个网页,比如是 http://localhost/123.php ,我希望这个地址能让所有的 IP 都能访问到,即便是来自国外的 IP 也能正常访问,应该如何写呢?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1180 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 23:10 · PVG 07:10 · LAX 16:10 · JFK 19:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.