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

请教一个 nginx 修改返回状态码的问题

  •  
  •   yuedingwangji · 2017-11-11 15:50:09 +08:00 · 3654 次点击
    这是一个创建于 2330 天前的主题,其中的信息可能已经有所发展或是发生改变。

    RT, 比如我在要在用户访问某个图片 rul 的时候, 将原来返回的 200 状态码 修改为 502,请问该怎么做? 可能说得不明确 , 我的想法是利用 location 让用户访问这个 url 的时候, 返回我自己定义的状态码

    3 条回复    2017-11-12 21:23:58 +08:00
    okletswin
        1
    okletswin  
       2017-11-11 16:20:03 +08:00
    location /xxx {
    return 502
    }

    凭印象写的,顺着思路查一查吧
    daggerjames
        2
    daggerjames  
       2017-11-11 16:36:53 +08:00
    看上去像是一个防盗链的需求。。。 [随手一搜]( http://itindex.net/detail/54493-%E5%AE%8C%E7%BE%8E-nginx-%E5%9B%BE%E7%89%87)
    huayun
        3
    huayun  
       2017-11-12 21:23:58 +08:00
    http://blog.csdn.net/my_one_piece/article/details/77161992
    可以参考下这个,不过能详细的说说需求最好了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2599 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 15:37 · PVG 23:37 · LAX 08:37 · JFK 11:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.