To any newbies with setting up NGINX it can be a dull and painful experience, or an enjoyable one if you’re that way inclined.
Installing on Debian is simple but there’s a little trick you MUST remember to do: If you are getting “520 bad gateway” and in your error log getting “2017/03/13 00:01:02 [error] 10441#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 20.30.40.50, server: test.website.com, request: “GET / HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “test.website.com”” go to edit this file: /etc/php5/fpm/pool.d/www.conf and add:
listen.allowed_clients = 127.0.0.1
Just add it on the bottom. Save and quit out and then do:
service php5-fpm restart
service nginx restart
You should now find your site loads fine.