I have ubuntu server with nginx that crashing from time to time and i cant handle why.
Ubuntu 20.04.4 Nginx version: nginx/1.18.0 (Ubuntu)
My logs:
2022/11/22 22:14:11 [info] 4076541#4076541: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:102
2022/11/22 22:14:12 [notice] 4076546#4076546: signal process started
2022/11/22 22:14:15 [notice] 4076550#4076550: signal process started
2022/11/22 22:14:18 [notice] 4076553#4076553: signal process started
2022/11/22 22:14:18 [error] 4076553#4076553: open() "/run/nginx.pid" failed (2: No such file or directory)
What should I do to fix this?
My nginx working well now, and after: ‘systemctl start nginx.service’ nginx started without any errors but from practice if i’ll wait some time (it’s may be day or one week) nginx will crash again
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
It is difficult to find out the problem without more information.
Is there anything relevant in /var/log/syslog?
The official nginx debugging page may be helpful.
It may also be that the process works correctly and that at a specific moment a process reach the memory limit that your Droplet supports and it is crashed, it would be enough to add more memory to your droplet.
Hope that helps you,
Sergio Turpín
Hi there,
Indeed as Sergio mentioned, it is best to check the /var/log/syslog for more information no why the service might be crashing.
I’ve seen a similar problem in the past caused by Certbot.
The following lines in the renewal config files at /etc/letsencrypt/renewal/* with outdated versions of Certbot might cause the problem:
post_hook = service nginx start
pre_hook = service nginx stop
What I had to do was to upgrade Cerbot to the latest version:
sudo apt-get update
sudo apt-get install certbot python-certbot-nginx
After that upgrade the pre_hook and post_hook lines should no longer be in the renewal config files.
Hope that this helps!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.