emptygif
语言: 简体中文

所有语言和框架

nginx (empty_gif) nginx

一个用于 nginx (empty_gif) 的 nginx 代码片段,以空 GIF 响应对 /pixel.gif 的请求,GIF 在启动时只解码一次。

nginx (empty_gif) nginx

文件
pixel.conf
运行
nginx -s reload
# ngx_http_empty_gif_module ships with standard nginx builds. empty_gif always
# serves nginx's own built-in 43-byte transparent 1x1 GIF; its bytes can't be
# changed (to serve your own GIF, use the static-file or njs variants).
server {
    listen 8080;

    location = /pixel.gif {
        empty_gif;
        add_header Cache-Control "no-store";
    }
}

我们运行了此代码片段,并比对了它返回的字节。

验证

curl -sI http://localhost:8080/pixel.gif

官方网站: nginx (empty_gif)

更多 nginx 示例