NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
Lyrical
V2EX  ›  NGINX

Nginx 中如何放行一个网页

  •  
  •   Lyrical · Jan 19, 2019 · 2287 views
    This topic created in 2697 days ago, the information mentioned may be changed or developed.

    在以下场景中,如何在 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 也能正常访问,应该如何写呢?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1058 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:02 · PVG 03:02 · LAX 12:02 · JFK 15:02
    ♥ Do have faith in what you're doing.