{"id":2187,"date":"2014-06-26T00:52:20","date_gmt":"2014-06-25T20:52:20","guid":{"rendered":"http:\/\/nayarweb.com\/blog\/?p=2187"},"modified":"2014-06-26T00:53:30","modified_gmt":"2014-06-25T20:53:30","slug":"502-bad-gateway","status":"publish","type":"post","link":"https:\/\/nayarweb.com\/blog\/2014\/502-bad-gateway\/","title":{"rendered":"502 Bad Gateway"},"content":{"rendered":"<p>Suddenly, i would get a 502 Bad Gateway page while trying to access my localhost nginx web server.<\/p>\n<p>Looking at nginx log, found these<br \/>\n<code><br \/>\n$ cat \/var\/log\/nginx\/error.log<br \/>\n---<br \/>\n2014\/06\/26 00:26:10 [crit] 1260#0: *2 connect() to unix:\/var\/run\/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: localhost, request: \"GET \/test.php HTTP\/1.1\", upstream: \"fastcgi:\/\/unix:\/var\/run\/php5-fpm.sock:\", host: \"localhost\"<br \/>\n<\/code><\/p>\n<p>I remembered having firing the system updater few hours ago. Looking at the logs<br \/>\n<code><br \/>\ncat \/var\/log\/apt\/history.log<br \/>\n<\/code> <\/p>\n<p>I see php5-fpm, php5-mysql, php5-common, php5-readline, php5-cli have been updated. I guess this is what caused the breakup.<\/p>\n<p>I tried re-installing them<br \/>\n<code>$ sudo apt-get install --reinstall php5-fpm<br \/>\n---<br \/>\nReading package lists... Done<br \/>\nBuilding dependency tree<br \/>\nReading state information... Done<br \/>\nYou might want to run 'apt-get -f install' to correct these:<br \/>\nThe following packages have unmet dependencies:<br \/>\n libwebkitgtk-3.0-0 : Depends: libjavascriptcoregtk-3.0-0 (= 2.4.2-1ubuntu0.1) but 2.4.3-1ubuntu2 is to be installed<br \/>\nE: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).<br \/>\n <\/code><\/p>\n<p>I ran<br \/>\n<code>$ apt-get -f install <\/code><\/p>\n<p>Apparently the last update didn&#8217;t complete. But i&#8217;m still getting the 502 error :-\/<\/p>\n<p>But then googling more about the nginx log, someone posted a magical solution <a href=\"http:\/\/stackoverflow.com\/questions\/23443398\/nginx-error-connect-to-php5-fpm-sock-failed-13-permission-denied\" target=\"_blank\">here<\/a><\/p>\n<p><code><br \/>\n$ chmod 666 \/var\/run\/php5-fpm.sock<br \/>\n<\/code><\/p>\n<p>Problem Solved \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Suddenly, i would get a 502 Bad Gateway page while trying to access my localhost nginx web server. Looking at nginx log, found these $ cat \/var\/log\/nginx\/error.log &#8212; 2014\/06\/26 00:26:10 [crit] 1260#0: *2 connect() to unix:\/var\/run\/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: localhost, request: &#8220;GET \/test.php HTTP\/1.1&#8221;, upstream: &#8220;fastcgi:\/\/unix:\/var\/run\/php5-fpm.sock:&#8221;, host: &hellip; <a href=\"https:\/\/nayarweb.com\/blog\/2014\/502-bad-gateway\/\" class=\"continue-reading\">Continue reading <span class=\"screen-reader-text\">502 Bad Gateway<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[57,61,190,109],"class_list":["post-2187","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-kubuntu","tag-linux","tag-nginx","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/2187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/comments?post=2187"}],"version-history":[{"count":2,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/2187\/revisions"}],"predecessor-version":[{"id":2189,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/2187\/revisions\/2189"}],"wp:attachment":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/media?parent=2187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/categories?post=2187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/tags?post=2187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}