Daphne 301 redirect | ERR_TOO_MANY_REDIRECTS

The Error was because of the Cloudflare.

I have Cloudflare on my domain and in my DNS i have Proxied enabled because of which the request was not directly going from domain to my server instead it was coming from Cloudflare server because of which nginx was unable to identify server name instead it was using the other conf file which had localhost as servername.

To fix this problem i disabled the Cloudflare Proxied option.

Now the request is going directly from domain to server and nginx is using the domain conf file instead of using localhost conf file and now it is working fine.