Hi Wesley,

I can not get information because the nginx service does not start.

You're right, actually have to use the file /lib/systemd/system/nginx.service. However, the file does not exist. I find this file on debian 8 : /run/systemd/generator.late/nginx.service

---
[Unit]
SourcePath=/etc/init.d/nginx
Description=LSB: Stop/start nginx
Before=runlevel2.target runlevel3.target runlevel4.target runlevel5.target shutdown.target
After=network-online.target remote-fs.target local-fs.target
Wants=network-online.target
Conflicts=shutdown.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SysVStartPriority=1
ExecStart=/etc/init.d/nginx start
ExecStop=/etc/init.d/nginx stop
ExecReload=/etc/init.d/nginx reload
---

I followed your instructions :

  * I create the nginx.service in /lib/systemd/system/nginx.service
  * I add "LimitNOFILE=65536"
---
[Unit]
SourcePath=/etc/init.d/nginx
Description=LSB: Stop/start nginx
Before=runlevel2.target runlevel3.target runlevel4.target runlevel5.target shutdown.target
After=network-online.target remote-fs.target local-fs.target
Wants=network-online.target
Conflicts=shutdown.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SysVStartPriority=1
ExecStart=/etc/init.d/nginx start
ExecStop=/etc/init.d/nginx stop
ExecReload=/etc/init.d/nginx reload
LimitNOFILE=65536
---
   * systemctl daemon-reload && systemctl restart nginx

Now it works perfectly !

Thank you very much Wesley.

I have a question, I use the official repository nginx.
---
deb http://nginx.org/packages/debian/ jessie nginx
deb-src http://nginx.org/packages/debian/ jessie nginx
---

Would it be possible to create the nginx.service file during installation of nginx?

Thank you the nginx community.

Regards,
Alexandre.


On 29/06/2016 12:21, Sernate wrote:
Hi,

What does a 'cat /proc/PID/limits' (replace PID with the NGINX PID number)
show you ?

The limits.conf file does not apply to systemd services.
Edit the file /lib/systemd/system/nginx.service and within the '[Service]'
section the following: LimitNOFILE=65536
After that run: systemctl daemon-reload && systemctl restart nginx

Wesley

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,267940,267949#msg-267949

_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to