Skip to content

UnixTeacher Posts

How to optimize images from command line

I’m using the following tools to perform lossless image compression: jpegoptim – jpegoptim is a utility for optimizing JPEG files. It provides lossless optimization (based on optimizing the Huffman tables) and “lossy” optimization based on setting a maximum quality factor. optipng – OptiPNG is a PNG optimizer that recompresses the image files to a smaller…

Blocking access by user agent in Nginx

How to block access by user agent in Nginx. In this configuration, i will use ngx_http_map_module. Inside http section: include /etc/nginx/blacklist; Inside server section (virtual host). We will return 444 status code. if ($block_ua) { return 444; } The blacklist file (example) map $http_user_agent $block_ua { default 0; ~*profound 1; ~*scrapyproject 1; ~*netcrawler 1; ~*nmap…

© 2022 - Marian Amza. All rights reserved.
Powered by Wordpress & Debian