Optimize WebserverDevOps

Avoid error with “too many open files”. It happens when the Swoole master process spawned so many child processes that open so many files, that it stops working.

sudo nano /etc/systemd/system.conf
DefaultLimitNOFILE=16384:524288

Apply Changes:

sudo systemctl daemon-reexec

Or restart the server.

/etc/nginx/nginx.conf

events {
    worker_connections 4096;  # Increase from default 768
}

Sources:

https://www.howtogeek.com/805629/too-many-open-files-linux/

https://www.baeldung.com/linux/error-too-many-open-files (Old)