Skip to content

Setup Installation

Conor McKnight edited this page Aug 24, 2025 · 1 revision

Welcome to the Nginx-Lua-minification-library wiki!

Usage :

Edit settings inside minify.lua to add your own mime types or improve my regex. (Please share your soloutions and additions)

https://github.com/C0nw0nk/Nginx-Lua-minification-library/blob/master/lua/minify/minify.lua

Add this to your Nginx configuration folder.

nginx/conf/lua/minify

Once installed into your nginx/conf/ folder.

Add this to your HTTP block or it can be in a server or location block depending where you want this script to run for individual locations the entire server or every single website on the server.

lua_shared_dict html_cache 10m; #HTML pages cache
access_by_lua_file conf/lua/minify/minify.lua;

Example nginx.conf :

This will run for all websites on the nginx server

http {
#nginx config settings etc
lua_shared_dict html_cache 10m; #HTML pages cache
access_by_lua_file conf/lua/minify/minify.lua;
#more config settings and some server stuff
}

This will make it run for this website only

server {
#nginx config settings etc
lua_shared_dict html_cache 10m; #HTML pages cache
access_by_lua_file conf/lua/minify/minify.lua;
#more config settings and some server stuff
}

This will run in this location block only

location / {
#nginx config settings etc
lua_shared_dict html_cache 10m; #HTML pages cache
access_by_lua_file conf/lua/minify/minify.lua;
#more config settings and some server stuff
}
Clone this wiki locally