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

nginx if 语句 return 403,没办法跳转自定义 403 页面

  •  
  •   dunhanson · 14 天前 · 1022 次点击

    nginx if 语句 return 403 ,没办法跳转自定义 403 页面

    返回的 403 还是 nginx 自带的 403 页面

    error_page 403 /403.html;
    location = /403.html {
    	root D:/program/nginx/nginx-1.18.0/html;
    }
    
    if ($http_user_agent ~ "Baiduspider") {
    	return 403;
    }
    
    1 条回复    2024-09-02 18:20:24 +08:00
    caola
        1
    caola  
       14 天前
    error_page 403 /your_path/403.html
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1001 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 19:16 · PVG 03:16 · LAX 12:16 · JFK 15:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.