<div dir="ltr"><div>"worker_rlimit_nofile set RLIMIT_NOFILE for workers only, so master process still sees previous value."<br><a href="http://mailman.nginx.org/pipermail/nginx/2008-April/004596.html">http://mailman.nginx.org/pipermail/nginx/2008-April/004596.html</a><br>
<br></div><div>If worker_rlimit_nofile doesn't affect the master process and limits.conf doesn't affect init script, do I need to call ulimit in the init.d script?<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Jun 4, 2013 at 4:25 PM, Sergey Budnevitch <span dir="ltr"><<a href="mailto:sb@waeme.net" target="_blank">sb@waeme.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On 4  Jun2013, at 17:04 , pablo platt <<a href="mailto:pablo.platt@gmail.com">pablo.platt@gmail.com</a>> wrote:<br>
<br>
> It's not clear to me how worker_rlimit_nofile, /etc/security/limits.conf and setting ulimit in the init.d script are related.<br>
><br>
> Is worker_rlimit_nofile the same as using ulimit in the init.d script?<br>
> Or does ulimit sets the maximum limit and worker_rlimit_nofile the limit per worker?<br>
<br>
</div>All of them set RLIMIT_NOFILE (man 2 setrlimit).<br>
If there is worker_rlimit_nofile directive in nginx.conf, nginx master process<br>
sets RLIMIT_NOFILE for new workers processes. This works no matter how<br>
you start nginx.<br>
ulimit -n in init script will works if nginx is started by init script.<br>
limits.conf is used by pam_limits, so it works for:<br>
% grep pam_limits /etc/pam.d/*<br>
/etc/pam.d/atd:session    required   pam_limits.so<br>
/etc/pam.d/cron:session    required   pam_limits.so<br>
/etc/pam.d/login:session    required   pam_limits.so<br>
/etc/pam.d/sshd:session    required     pam_limits.so<br>
/etc/pam.d/su:# session    required   pam_limits.so<br>
<br>
atd, cron, login, sshd processes and their child processes,<br>
for example when you login locally or via ssh.<br>
<div class="im"><br>
<br>
><br>
> Why does the init.d script from the ubuntu repo let me set using ulimit while the package from <a href="http://nginx.org" target="_blank">nginx.org</a> doesn't?<br>
> <a href="https://gist.github.com/aganov/1121022#file-nginx-L43" target="_blank">https://gist.github.com/aganov/1121022#file-nginx-L43</a><br>
><br>
> Does /etc/security/limits.conf has any effect on the nofile limit in nginx when it is started using init.d script?<br>
> For upstart, I know that you have to set the limit in the upstart script and can't use /etc/security/limits.conf<br>
<br>
</div>limits.conf will not work if init script is started on system boot.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
><br>
><br>
> On Tue, Jun 4, 2013 at 3:39 PM, Maxim Dounin <<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>> wrote:<br>
> Hello!<br>
><br>
> On Tue, Jun 04, 2013 at 04:30:40PM +0400, Sergey Budnevitch wrote:<br>
><br>
> ><br>
> > On 4  Jun2013, at 15:39 , pablo platt <<a href="mailto:pablo.platt@gmail.com">pablo.platt@gmail.com</a>> wrote:<br>
> ><br>
> > > Hi,<br>
> > ><br>
> > > I'm using the ubuntu package from <a href="http://nginx.org" target="_blank">nginx.org</a>.<br>
> > ><br>
> > > In the package from the official ubuntu repo, you can set file descriptor limit by changing /etc/default/nginx<br>
> > > # Check if the ULIMIT is set in /etc/default/nginx<br>
> > > if [ -n "$ULIMIT" ]; then<br>
> > >     # Set the ulimits<br>
> > >     ulimit $ULIMIT<br>
> > > fi<br>
> ><br>
> > ulimit without flags sets max file size in blocks, not file descriptor limit, so<br>
> > you may fill a bug in their bug tracker.<br>
><br>
> I think the expected use is to supply arguments within the ULIMIT<br>
> variable.<br>
><br>
> --<br>
> Maxim Dounin<br>
> <a href="http://nginx.org/en/donation.html" target="_blank">http://nginx.org/en/donation.html</a><br>
><br>
> _______________________________________________<br>
> nginx mailing list<br>
> <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
> <a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
><br>
> _______________________________________________<br>
> nginx mailing list<br>
> <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
> <a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div>