[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can nginx "events" block be configured in an include file?



On Tue 03 Nov 2020 at 08:03:24 (-0600), Dave Sherohman wrote:
> On Tue, Nov 03, 2020 at 07:57:40AM -0500, Greg Wooledge wrote:
> > On Tue, Nov 03, 2020 at 03:35:58AM -0600, Dave Sherohman wrote:
> > > tl;dr:  I need to increase worker_connections on my nginx servers, but
> > > don't want to edit the debian-provided nginx.conf due to that causing
> > > future upgrade hassles.  Is this possible?
> 
> > No.
> 
> Ah, well.  That's what I expected, but thanks for confirming it.
> 
> Another (off-list) reply suggested using a script to edit nginx.conf
> rather than doing it by hand, which looks like the best solution for my
> specific case.

I obviously haven't seen that suggestion, but why write a script
yourself when software exists to do that already.

Keep a copy of the original file, and then edit the file so that it
works in the way you require. Now run diff on the two files and
keep the output.

When the package is upgraded and your configuration is modified,¹
you can feed the new file and your diff file into patch, which
will merge them to produce the new configuration +with+ your edits.

Before you do any of this, read   man patch   to get an overview
of what patch can do for you.

> My site-specific config files are generated from
> templates using a Perl deployment script, and I also have hooks there
> which I can use to edit nginx.conf without needing to generate the whole
> thing from a template, and that will also handle nginx config changes
> coming from debian by re-patching the config the next time we deploy.

Patch, of course, has the same pedigree as Perl, both being creations
of Larry Wall.

¹ If your configuration file is actually a package's conffile,
  then much of the work above will be duplicated by the
  installation scripts using the conffile.dpkg-{old,new,tmp}
  mechanism.

Cheers,
David.


Reply to: