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

求个nginx的规则

  •  
  •   notedit ·
    notedit · Nov 10, 2013 · 3431 views
    This topic created in 4592 days ago, the information mentioned may be changed or developed.
    有电影的剧照几张, 每个剧照只有一张图片, 但需要在电影详情页显示小图, 在单个剧照页面显示大图 (用到upyun的自动剪裁功能)

    现在需要在nginx那里配置一下 如果访问的是 /film/xxxx 剧照图片就rewrite到小图(在图片路径后面加 !100x140) 在单个剧照页面 /film/xxxx/photo/xxxx 页面显示大图(在路径后面加 !500x700)

    需要在nginx配置里面进行配置 求个具体的规则
    3 replies    1970-01-01 08:00:00 +08:00
    Livid
        1
    Livid  
    MOD
    PRO
       Nov 10, 2013 via iPhone   ❤️ 1
    这件事情好像更应该是在模板系统里做
    cute
        2
    cute  
       Nov 10, 2013   ❤️ 1
    if ($http_referer ~*/film/[^/]+/photo/[^/]+) {
    rewrite ^/.*.jpg$ $0!100x140;
    }

    if ($http_referer ~*/film/[^/]+) {
    rewrite ^/.*.jpg$ $0!500x700;
    }
    dorentus
        3
    dorentus  
       Nov 10, 2013
    于是像我这种配置浏览器不发 referer 的就一直看到的是大图么……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   859 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:38 · PVG 04:38 · LAX 13:38 · JFK 16:38
    ♥ Do have faith in what you're doing.