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 範例