Today when i tried to access my blog, i received an 520 error in response. I am using CLOUDFLARE CDN and 520 error response suggested that there was something wrong with my server.
520 error is essentially a catch-all response for when the origin server returns something unexpected or something that is not tolerated/interpreted (protocol violation or empty response).
so I checked the error logs of my server and i found this error
(13: Permission denied) while reading upstream, client: 162.158.167.161, server: , request: "GET /how-to-install-lamp-in-centos-7/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.debyum.com", referrer: "https://www.debyum.com/":
Error Log:
[root@debyum ~]# tail -f /var/log/nginx/error.log 2016/10/16 08:32:04 [crit] 32384#0: *6893 open() "/var/lib/nginx/cache/fastcgi_temp/4/04/0000000044" failed (13: Permission denied) while reading upstream, client: 162.158.167.161, server: , request: "GET /how-to-install-lamp-in-centos-7/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.debyum.com", referrer: "https://www.debyum.com/" 2016/10/16 08:32:05 [crit] 32384#0: *6907 open() "/var/lib/nginx/cache/fastcgi_temp/5/04/0000000045" failed (13: Permission denied) while reading upstream, client: 162.158.167.161, server: , request: "GET /how-to-install-lamp-in-centos-7/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.debyum.com", referrer: "https://www.debyum.com/"<br>
Dealing with “Permission denied while reading upstream.” error.
As we can see here, the error suggested that there’s something wrong with permissions on /var/lib/nginx/cache/fastcgi_temp folder.
when i checked the permissions on my Fastcgi_temp directory.
[root@debyum ~]# ls -ld /var/lib/nginx/cache/fastcgi_temp drwx------. 12 root root 4096 Oct 15 19:26 /var/lib/nginx/cache/fastcgi_temp
But the nginx process was running with user nginx:nginx
user nginx nginx; worker_processes auto; .............. ..............
then i changed the ownership of /var/lib/nginx/cache/fastcgi_temp accordingly.
[root@debyum ~]# chown -R nginx:nginx /var/lib/nginx/cache/fastcgi_temp
Reload the nginx
So we will reload nginx now.
[root@debyum ~]# nginx -s reload
and everything should be working fine.
[root@debyum ~]# tail -f /var/log/nginx/error.log 2016/10/16 08:36:45 [notice] 1003#0: signal process started.
Finally I Hope this post helps you in solving this error problem.. If there’s something that i have missed or should be included in this post , then please update us through comment box to help your fellow readers. I will keep updating the same based on feedback’s received. Thanks. Have a great day.????