Goning
V2EX  ›  问与答

关于 nginx 的 deny all 返回 403

  •  
  •   Goning · Oct 28, 2020 · 2369 views
    This topic created in 2198 days ago, the information mentioned may be changed or developed.
    怎么样写才能使 deny all 返回 444 呢?
    4 replies  •  2020-10-29 13:59:55 +08:00
    taolu
    taolu
    Oct 28, 2020
    1
    error_page 403 /444.html;

    location = /444.html {
    return 444;
    }
    AstroProfundis
    AstroProfundis
    Oct 28, 2020
    2
    也可以不写 deny all; 而直接写 return 444;
    Goning
    Goning
    OP
    Oct 28, 2020
    3
    @AstroProfundis
    我用的是 CF 访问,然后禁止非 CF 访问的 IP,但是非 CF 访问的 IP 得到返回是 403.想要弄成返回 444.怎么改
    location / {
    allow 173.245.48.0/20;
    allow 103.21.244.0/22;
    allow 103.22.200.0/22;
    allow 103.31.4.0/22;
    allow 141.101.64.0/18;
    allow 108.162.192.0/18;
    allow 190.93.240.0/20;
    allow 188.114.96.0/20;
    allow 197.234.240.0/22;
    allow 198.41.128.0/17;
    allow 162.158.0.0/15;
    allow 104.16.0.0/12;
    allow 172.64.0.0/13;
    allow 131.0.72.0/22;
    allow 2400:cb00::/32;
    allow 2606:4700::/32;
    allow 2803:f800::/32;
    allow 2405:b500::/32;
    allow 2405:8100::/32;
    allow 2a06:98c0::/29;
    allow 2c0f:f248::/32;
    deny all;
    }
    Goning
    Goning
    OP
    Oct 29, 2020
    4
    有没有写法呢?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5048 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 07:40 · PVG 15:40 · LAX 23:40 · JFK 02:40
    ♥ Do have faith in what you're doing.