On 2014/04/13 16:56, Ted Unangst wrote:
> Recently had a bit of an issue with the default nginx.conf and running
> out of files. By default, login.conf imposes a limit of 128 files,
> which is not nearly sufficient to process the configured 1024
> connections.
>
> We need to fix two things. First, raise the file limit to 1024.
> Second, lower the connection limit slightly. We need to save some file
> handles for logging and opening files and what not. nginx should (I
> hope) deal with hitting its own connection limit more calmly than
> unexpected accept()/open() failures.
>
> We can have many fine arguments about what these default values should
> be; for now I'm simply adjusting the config to self-consistent. 1024
> files is not such a preposterous amount in my opinion.
>
> Index: nginx.conf
> ===================================================================
> RCS file: /cvs/src/usr.sbin/nginx/conf/nginx.conf,v
> retrieving revision 1.18
> diff -u -p -r1.18 nginx.conf
> --- nginx.conf 27 Mar 2014 10:40:42 -0000 1.18
> +++ nginx.conf 13 Apr 2014 20:45:31 -0000
> @@ -14,9 +14,9 @@ worker_processes 1;
>
> #pid logs/nginx.pid;
>
> -
> +worker_rlimit_nofile 1024;
> events {
> - worker_connections 1024;
> + worker_connections 800;
> }
>
>
>
These values make sense to me, though I think some people didn't like
daemons themselves changing rlimit when this came up before, so we added
a login.conf section when this was needed for bgpd (handled by rc.subr
setting the class automatically).