Skip to content
cubicdaiya edited this page Jul 7, 2012 · 28 revisions

ngx_small_light

ngx_small_light is a dynamic image transformation module for Nginx. And ngx_small_light is written for using as the same way as mod_small_light as possible in Nginx.(mod_small_light is a Apache module)

Install

Install Dependencies

Before install ngx_small_light( and nginx), install following dependencies.

Install ngx_small_light

cd ${ngx_small_light_src_dir}
./setup
cd {$nginx_src_dir}
./configure --with-pcre --add-module=${ngx_small_light_src_dir}
make
sudo make install

Quick Start

Add following configuration to some server context in nginx.conf and start Nginx.

small_light on;
location ~ small_light[^/]*/(.+)$ {
    set $file $1;
    rewrite ^ /$file;
}

If you can get the original image of image.jpeg from following URL,

http://$host:$port/img/image.jpg

you will be able to get the converted image of image.jpeg from following URL.

http://$host:$port/small_light(dw=300,dh=300)/img/image.jpg

Configuration

The configuration guide explains how to describe a configuration to nginx.conf and about configuratve parameters.

Clone this wiki locally