0

I am having problem with nginx consuming a lot of ram and cpu space. Even though I used the command

sudo kill -9 1254214

to kill it, but it turned back on automatically after a while.

enter image description here

If anybody face the problem and know how to fix it.Hope you'll help me to solve it. Thank you so much!

Nguyen Hung
  • 127
  • 2
  • 10
  • It depends on a large number of variables, including the system specs, what Nginx is hosting, etc. – Will Walsh May 12 '21 at 02:42
  • @WillWalsh Do you have a solution? – Nguyen Hung May 12 '21 at 02:54
  • Your question is off-topic in StackOverflow. You have a better chance to get it answered if you move it to [Unix & Linux](https://unix.stackexchange.com/tour) or to [Superuser](https://superuser.com). – accdias May 12 '21 at 06:36

1 Answers1

1

Change the log_format in /etc/nginx.conf to

    log_format  main  '$remote_addr $http_x_forwarded_for [$time_iso8601] '
                      '$status $request_length $body_bytes_sent $request_time $upstream_response_time '
                      '"$request" "$http_referer" $ssl_protocol/$ssl_cipher $ssl_ciphers';

and enable it in access_log /var/log/nginx/access.log main;

Then you can see how much time it takes to serve each individual request and whether it uses CPU-intensive SSL cipher. Once you know the most heavy-load URLs - you should have a better idea why they are slow.

IVO GELOV
  • 13,496
  • 1
  • 17
  • 26