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

nginx 大佬过来看看怎么弄?

  •  
  •   xx3122 · Sep 1, 2022 · 2390 views
    This topic created in 1390 days ago, the information mentioned may be changed or developed.

    1.想要的效果是 nginx 日志记录出状态为 403 ,但浏览器看状态为 200 ,该怎么配置,我以前配置成功了的但是忘了

    error_page 403 503 =200 @403;
    location @403 { default_type application/json;
    return 200 '{"code":"403", "message": "请使用高级浏览器访问本站比如 Chrome 、火狐等访问,谢谢!"}';
    break;
    }
    location /ip {
    add_header Content-Type text/html;
    return 403;
    }

    日志:"GET /ip?dfs=dasd&sd=112 HTTP/1.1" 403

    xx3122
        1
    xx3122  
    OP
       Sep 1, 2022
    另外 add_header 、more_set_headers 、default_type 有啥区别啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   907 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:35 · PVG 05:35 · LAX 14:35 · JFK 17:35
    ♥ Do have faith in what you're doing.