By SP1
Hi, Suddenly the CPU and Bandwidth spiked on its own 2 times and the site went down for 5-10 mins.
Image - https://i.ibb.co/HqYK93F/1.png Example link
Checking logs saw this error - [alert] 12197#0: *2936829 socket() failed (24: Too many open files) while connecting to upstream on NGINX
100’s of these error entries from the same 4-5 IPS.
Example link Image - https://i.ibb.co/Jv5SdpT/2.png
Read a few places, to increase files, some said it could be server-side problem contact admins. Can someone help with a solution so we do not face this.
Thanks website - www.gadgetbridge.
P.S strange thing was when I tried opening DO community page, I got a 502 error here also.
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!
Hi @SP1,
There are two ways to go about this.
The first would be to increase the limits on your Nginx configuration to see if that will appear again.
You can change the maximum number of file descriptors a process can create by modifying the /etc/sysctl.conf file and adding the fs.file-max setting. Set fs.file-max=50000 to allow processes to create 50000 file descriptors.
Then you can modify the security limits in /etc/security/limits.conf. You can set these by adding two lines nginx soft nofile 10000 and nginx hard nofile 30000 . Then run sysctl -p to verify our change.
Finally, open up your /etc/nginx/nginx/conf file and add the worker_rlimit_nofile directive like so worker_rlimit_nofile 30000;. Then reload nginx.
The second suggestion is that you’ve been a target of a DDoS and it’s not something specific with your Droplet to worry about. If it was me, I’ll wait before making the above changes, I don’t think they are necessary most of the time and see when the next time this error appears the IP addresses that are accessing your website.
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.