
Nginx 1.9.11 with Dynamic Modules - Nekit1234007
http://mailman.nginx.org/pipermail/nginx-announce/2016/000170.html
======
timdorr
A little more explanation of what that means from the docs:

In NGINX 1.9.11 onwards a new way of loading modules dynamically has been
introduced. This means that selected modules can be loaded into NGINX at
runtime based on configuration files. They can also be unloaded by editing the
configuration files and reloading NGINX.

[https://www.nginx.com/resources/wiki/extending/converting/](https://www.nginx.com/resources/wiki/extending/converting/)

~~~
whalesalad
Hugely important. Compiling your own Nginx has never been trivial in modern
development pipelines, and until now that's been the only way to use external
modules.

~~~
derFunk
Honest question: Why do you think it was non-trivial? What is/was complex?

~~~
ownagefool
I found that nginx actually "just works", however not all software is easy to
compile and many of us shy away from compiling for various reasons.

~~~
pmlnr
Compiling nginx is surprisingly easy and straightforward; a perfect example to
get started with packaging for yourself.

~~~
sgt
Indeed - but having built an nginx module, it's hard to convince others to use
it. Often, nginx users are simply using the binary packages from their Linux
distribution, and if they compile their own, they'll have to remember that
they have a version that's compiled from source on the system and not the
packaged one.

~~~
taf2
Exactly and then when it is time to patch nginx you can't just install a new
binary and reload - you have to have documented exactly right set of modules
previously compiled. Depending on the modules this can be time consuming and
error prone. Not impossible, but adds additional automation requirements.

------
pnommensen
We've just posted a blog post "Introducing Dynamic Modules in NGINX 1.9.11."
[https://www.nginx.com/blog/dynamic-modules-
nginx-1-9-11/](https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/)

We'll take a read through the comments here and are looking forward to
answering questions and receive feedback. You may also email the NGINX
development mailing list (info in blog post).

(I work @ NGINX).

~~~
lumannnn
Hey :)

I've just created a separate HN submission pointing to your blog post.

I hope you don't mind.

Keep up the amazing work!

------
SwellJoe
We support nginx in our products, due to high demand for it, but we don't
really like the way it has historically handled modules. Having to custom-
build to do interesting things is very far away from the "plug and play"
experience that our users expect and can get with Apache.

While I'm not on the bandwagon that says all Apache installations would be
better on nginx (and I still run Apache on all of our servers, except nginx
test machines), I do think this makes the case quite a bit more compelling,
particularly for people who package and distribute the web server (OS vendors,
control panel maintainers like me, container builders, etc.).

------
zevrox
If I could get mod_pagespeed, mod_security and mod_cloudflare configured
without recompiling/accidentally breaking everything, I'd be so ecstatic.

------
dujiulun2006
Good for them.

It's worth to note that an nginx fork called Tengine (by Taobao) has a similar
feature before.

[http://tengine.taobao.org/index.html](http://tengine.taobao.org/index.html)

~~~
ksec
Yes and the only reason why Taobao forked it was because Nginix did not allow
such feature to be upstream.

------
Nekit1234007
Docs:
[https://www.nginx.com/resources/wiki/extending/](https://www.nginx.com/resources/wiki/extending/)

------
withjive
Is this going to make it easier to get luajit on a stock nginx server?

I just see a single bullet point regarding "Dynamic modules", anywhere I can
get more info?

~~~
CrLf
Probably not. The lua module hooks into internal symbols not considered part
of the module API.

~~~
cbr
Nginx doesn't really have a module API. While lua reaches deep inside,
loadable modules already have to be compiled for the specific nginx version,
which means this module isn't in a different situation from any of the others.

------
mixmastamyk

        load webserver.nlm
    

(a reference for the old-timers here)

Seems an odd feature for 1.9.11, why not wait for 2.0?

~~~
uggedal
The 1.9 series is unstable (mainline) while 1.8 is stable. Classic odd/even
unstable/stable versioning.

~~~
mixmastamyk
This is the answer, I had forgotten about this strategy.

------
vbtechguy
Looking good so far I have enabled a few Nginx dynamic modules including
Openresty's set-misc, echo and headers more modules
[https://community.centminmod.com/posts/26535/](https://community.centminmod.com/posts/26535/)

    
    
      load_module "modules/ngx_http_image_filter_module.so";
      load_module "modules/ngx_http_headers_more_filter_module.so";
      load_module "modules/ngx_http_set_misc_module.so";
      load_module "modules/ngx_http_echo_module.so";
      load_module "modules/ngx_http_geoip_module.so";
      load_module "modules/ngx_stream_module.so";

------
stereo
This is great news for the pagespeed people.

~~~
cbr
Unfortunately, it looks like it may not be something will be able to work
with. Instead of an ABI like Apache uses, Nginx went with signature checking.
To load a precompiled module, the signature has to match. This means we would
have to compile many different binary modules for every configuration people
might have, and for every version of Nginx. Like several dozen.

As it stands, though, the module system would be very helpful for OS
packagers, because they don't have to worry about signature mismatch.

~~~
falcolas
I would think that containers would help obviate such concerns, since it would
be rather trivial to keep even a hundred images in place for an automated
compilation run.

Of course, serving the output would be harder, but still not impossible.

~~~
xorcist
How does containers help? Building a hundred different nginx's shouldn't be
neither harder nor easier if you stuff the binary in a container or not.

~~~
falcolas
It gives you one image per configuration, instead of one build machine, or one
stored VM. It makes it easier for a single machine to iterate over dozens or
hundreds of build environments with a minimum of overhead.

For example, one Ubuntu machine with Docker can create build environments for
every Linux based distro (and version thereof) that exists, and iterate
through all of them when it comes time to build. The setup is not trivial,
though it is easier than creating a similar environment with VMs or physical
machines.

~~~
snuxoll
Every distribution on the planet handles this with chroots for doing builds
and it works out just fine without needing to do gymnastics with docker.
Fedora, for example, has a farm of build hosts that are architecture specific
(so there is no cross-compiling outside of bootstrapping a new build target),
from there a new chroot gets created for every build and the build runs
isolated within it. They've been using this same system to maintain packages
for up to 7 different releases at once (counting the EPEL repositories) with
no issues, I fail to see any benefit docker brings to the table here - and
really, nginx should just provide a stable ABI.

------
vbtechguy
Well got nginx 1.9.11 stack installer dynamic module ready almost with
ngx_brotli fixed, lua nginx module patched
[https://community.centminmod.com/posts/26128/](https://community.centminmod.com/posts/26128/)
just missing ngx_pagespeed compatibility and i'd be happy as a pig in mud :)

------
frik
Is this going to make it easier to enable stub_status module without compiling
Nginx? (or buying NginxPlus)

[http://nginx.org/en/docs/http/ngx_http_stub_status_module.ht...](http://nginx.org/en/docs/http/ngx_http_stub_status_module.html)

~~~
akurtzhs
What problems are you having using stub_status?

I'm using the nginx mainline PPA and didn't have a problem enabling it.

~~~
frik

      This module is not built by default, it should be enabled 
      with the --with-http_stub_status_module configuration 
      parameter
    

I had to compile Nginx myself, because that module was absent. As you can read
also on various community pages, boards, etc.

Nginx is the only server software that I have to compile myself, just to get a
basic status feature. It's a way to upsale people to their NginxPlus which
offer a lot more status data in the binary.

~~~
ArmTank
[http://nginx.org/en/linux_packages.html#arguments](http://nginx.org/en/linux_packages.html#arguments)

    
    
      Configure arguments common for nginx binaries
      from pre-built packages for stable version: 
      ...
      --with-http_stub_status_module
      ...

------
pibefision
Does Dynamic modules will help to enable mod_pagespeed easily?

~~~
cbr
Sadly, probably not:
[https://news.ycombinator.com/item?id=11066250](https://news.ycombinator.com/item?id=11066250)

~~~
toupeira
Compiling a module is still a lot more straight-forward than recompiling the
whole of Nginx, which is probably the main obstacle to people using it (at
least it is in my case).

~~~
cbr
Cool. We're working now to make this possible.

(And, in fact, to work at all when compiling against 1.9.11, since the
addition of dynamic modules broke us:
[https://github.com/pagespeed/ngx_pagespeed/issues/1110](https://github.com/pagespeed/ngx_pagespeed/issues/1110)
)

~~~
vbtechguy
Piotr is working his magic for ngx_pagespeed 1.10
[https://github.com/pagespeed/ngx_pagespeed/issues/1114](https://github.com/pagespeed/ngx_pagespeed/issues/1114)
just need a patch for 1.9 branch too

