WordPress – admin-ajax.php returns 502 Bad Gateway [closed]

I had similar problem on wordpress site. add these lines inside http block of /etc/nginx/nginx.conf file.

fastcgi_temp_file_write_size 10m;
fastcgi_busy_buffers_size 512k;
fastcgi_buffer_size 512k;
fastcgi_buffers 16 512k;

If it still not working also add this line

 client_max_body_size 50M;