15

How to start Nginx as service with this module?

According to this documentation, it says:

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

I don't understand where to enter this command. Is it nginx service start --with-http_sub_module? That is so confusing.

When I enter nginx -V it shows that --with-http_sub_module is available.

Mr.D
  • 7,353
  • 13
  • 60
  • 119

1 Answers1

29

If you see --with-http_sub_module in nginx -V output, you can be certain that the module is already built in. So simply use its directives in configuration file, there is no need to do any special magic to load the module itself.

Now as to why documentation says:

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

This applies to when you compile nginx yourself, e.g. run the standard ./configure && make && make install. So the module is not installed by default if you run ./configure without arguments.

But its worth noting that most packaged nginx builds (ones that you get from yum install nginx or e.g. apt install nginx) would have custom ./configure command, which (as in your case) already likely had the --with-http_sub_module as one of the configuration switches.

Danila Vershinin
  • 8,725
  • 2
  • 29
  • 35
  • Was looking into this and found it useful the explanation. Thank you.. Upvote – Sandeep Nair Mar 02 '21 at 08:29
  • Have to admit the statement in doc is quite a bit confusing! – holsety Jun 22 '21 at 06:23
  • 1
    For those looking for it, here is the option declartion fo the Debian package `nginx-core` (default for the `nginx` package): https://salsa.debian.org/nginx-team/nginx/-/blob/master/debian/rules#L95 – ggd Nov 22 '21 at 14:49