522 error on all the domain and subdomain hosted on different VPS

Hi,

I have a main domain and 4 subdomains which are hosted in 3 VPS configured on Ubuntu 16.04, Nginx and PHP 7.3. All 5 websites are installed with latest version of WordPress.

From the time I changed my name servers to CloudFlare I keep getting 522 error. However I have tried whitelisting CloudFlare IP addresses in UFW, added Proxy time out settings in Nginx. Below is the configuration with timeout settings:

fastcgi_cache_path /var/cache/ngx_fastcgi levels=1:2 keys_zone=fastcgi_cache:10m inactive=10m max_size=64m;
fastcgi_cache_key $scheme$host$request_uri;
fastcgi_cache_lock on;
fastcgi_cache_use_stale error timeout invalid_header updating http_500;
fastcgi_cache_valid 5m;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

reset_timedout_connection on;
client_body_timeout 12;
client_header_timeout 12;
send_timeout 10;
proxy_connect_timeout       600;

proxy_send_timeout 600;
proxy_read_timeout 600;

client_body_buffer_size 128k;
  client_header_buffer_size 1k;
  client_max_body_size 100M;
  large_client_header_buffers 4 256k;

But still when CloudFlare is enabled I get 522 error. How to resolve this issue? Can someone help me with this please?

Thank you,
Shirish

It sounds like the connection isn’t even reaching NGINX, so those settings aren’t going to help. Whitelisting at UFW is good, but if there’s something upstream that’s blocking it, you’ll have to contact your VPS provider and ask.