The module adjust image orientation automatically when resize image base http://nginx.org/en/docs/http/ngx_http_image_filter_module.html.
- Ubuntu/debain
sudo apt-get install libgd-dev
sudo apt-get install libexif-dev
- centos/redhat
sudo yum install gd gd-devel
sudo yum install libexif-devel
./configure --add-module=/path/to/ngx_http_image_filter_module