• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Question Nginx configuration for 1000 domains

stas styler

Basic Pleskian
Hi pleskians,

I'm having trouble with my server its getting 504\2 too often and I assume that the nginx.conf is the problem.
But i cant find it.

My server is 48 cores 128 GB ram with NVME 2tb, running centos7, nginx as reversed proxy and apache, 1gbit/s link.
this is my nginx.conf
Code:
#user  nginx;
worker_processes  48;
worker_rlimit_nofile 49152;
#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

#pid        /var/run/nginx.pid;

include /etc/nginx/modules.conf.d/*.conf;

events {
    worker_connections 24576;
    multi_accept on;
    use epoll;
}


http {

include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /dev/null;
    error_log   /dev/null;
    keepalive_timeout  15;
    server_tokens off;
    open_file_cache          max=10000 inactive=20s;
    open_file_cache_valid    30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors off;
    client_body_buffer_size 128K;
    client_header_buffer_size 1k;
    client_max_body_size 8m;
    large_client_header_buffers 4 256k;
    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    fastcgi_connect_timeout 600;
    fastcgi_send_timeout 600;
    fastcgi_read_timeout 600;
    proxy_connect_timeout       600;
    proxy_send_timeout          600;
    proxy_read_timeout          600;
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    client_header_timeout 15;
    client_body_timeout 15;
    send_timeout 15;
    autoindex off;


    include /etc/nginx/conf.d/*.conf;
}

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;


I'm trying to make that to work good but unfortunatelly i'm having problems.
I got 200 domains currently, some are high traffic, some are not (AVG 700Packets/s).

Is my nginx.conf configured somehow bad so its just timing out and crashes?
 
Well there are a lot of possabillitys which can cause the 504 & 502 messages, even if you search the forum for "Nginx 502 or 504", you will find dozens of threads. I assume you are you talking about this error on customer domains?

therefore you also should check the /var/log/nginx/error.log and /var/www/vhosts/system/example.com/logs/proxy_error_log for detailed error message. Helpfull is also when you provide OS & plesk version you have.

see for example:
[HUB] 502 Bad Gateway
A website is not accessible with "Nginx 504 Gateway Time-out": upstream timed out (110: Connection timed out) while reading response header from upstream
Websites are unavailable with 502 Bad Gateway on Plesk: upstream sent too big header while reading response header
 
Last edited:
Back
Top