Nginx subdomain not working


I have setup subdomain virtual host but its not working getting 522 error.

below code of Nginx subdomain conf file.

server {
listen 80;
listen [::]:80;
root /var/www/html/;
error_log /var/log/nginx/error.log;
index index.html;

location / {
  try_files $uri $uri/ =404;


main domain is working fine. I have also check nginx error log but its not showing any error.

Ubantu 18.10

anyone please suggest possible solution to fix this issue.


1 Reply

This appears to be a Cloudflare error as a 522 error occurs because CloudFlare could not make a TCP connection to your origin server before the attempts timed out. Have you reached out to Cloudflare yet about this issue?

Several conditions may cause Error 522 to appear. The most common causes include:

Overloaded web server
Blocked Cloudflare requests
Faulty network routing
Disabled keepalives

Other possible causes may also include:

Incorrect IP address in the Cloudflare DNS settings (i.e. the request from us was sent to the wrong place)
Offline origin web server
Dropped packets on the host network

Understand how Error 522 is triggered

When someone visits a Cloudflare-enabled website, a connection is established between Cloudflare and the website's origin server. To establish a connection, TCP uses a three-way handshake.

SYN: Cloudflare sends three SYN packets to the origin server.
SYN+ACK: In response, the origin server replies with a SYN+ACK.
ACK: Finally, Cloudflare sends an ACK back to the origin server.

At this point, both Cloudflare and the origin server have received an acknowledgement of the connection, and communication is established. If the origin server does not send a SYN+ACK back to Cloudflare within 15 seconds, a 522 error will occur and the connection is closed.

Additional details and troubleshooting steps can be found at the following link


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct