emptygif
Ngôn ngữ: Tiếng Việt

Tất cả ngôn ngữ và framework

nginx (empty_gif) nginx

Đoạn mã nginx cho nginx (empty_gif), trả lời các yêu cầu tới /pixel.gif bằng GIF rỗng, được giải mã một lần khi khởi động.

nginx (empty_gif) nginx

Tệp
pixel.conf
Chạy
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";
    }
}

Chúng tôi đã chạy đoạn mã này và so sánh các byte nó trả về.

Kiểm tra

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

Trang chính thức: nginx (empty_gif)

Thêm với nginx