We are running a Nginx Server but it is very slow and sometimes not even reachable. Sometimes it loads 20 seconds.
This is our config:
#Example Config
user www-data;
worker_rlimit_nofile 100000;
events {
worker_connections 4000;
use epoll;
multi_accept on;
}
http {
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_min_length 10240;
gzip_comp_level 1;
gzip_vary on;
gzip_disable msie6;
gzip_proxied expired no-cache no-store private auth;
gzip_types
# text/html is always compressed by HttpGzipModule
text/css
text/javascript
text/xml
text/plain
text/x-component
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
application/atom+xml
font/truetype
font/opentype
application/vnd.ms-fontobject
image/svg+xml;
# allow the server to close connection on non responding client, this will free up memory
reset_timedout_connection on;
# request timed out -- default 60
client_body_timeout 10;
client_max_body_size 10M;
# if client stop responding, free up memory -- default 60
send_timeout 2;
# server will close connection after this time -- default 75
keepalive_timeout 30;
# number of requests client can make over keep-alive -- for testing environment
keepalive_requests 100000;
include mime.types;
default_type application/octet-stream;
include fastcgi.conf;
server {
listen 443 ssl http2;
#listen 80 http2;
server_name ***;
root /**/**/**/;
# SSL certificate
ssl_certificate /**/**/**;
ssl_certificate_key /**/**/**;
index index.php index.html;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/(.*)$ /index.php?$1 last;
}
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
server_tokens off;
}
We also have multiple errors in the nginx/error.log:
2021/07/01 10:53:28 [error] 25453#25453: *81 upstream timed out (110: Connection timed out) while reading response header from upstream,
The errors are POST and GET requests.
Don't know if it has something to do with it.
Is there anything we can do?
Thanks in Advance!