{"id":281,"date":"2015-09-20T13:24:20","date_gmt":"2015-09-20T04:24:20","guid":{"rendered":"http:\/\/www.cotegg.com\/blog\/?p=281"},"modified":"2015-09-20T13:24:20","modified_gmt":"2015-09-20T04:24:20","slug":"%e3%80%90nginxunicorn%e3%80%9113-permission-denied-while-connecting-to-upstream","status":"publish","type":"post","link":"https:\/\/www.cotegg.com\/blog\/?p=281","title":{"rendered":"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream"},"content":{"rendered":"<p>\u3069\u3046\u3082\u4e2d\u7530\u3067\u3059\u3002<\/p>\n<p>AWS\u4e0a\u3067API\u30b5\u30fc\u30d0\u3092\u69cb\u7bc9\u3057\u3066\u3066\u3001<br \/>\n* Web\u30b5\u30fc\u30d0\uff1anginx<br \/>\n* AP\u30b5\u30fc\u30d0\uff1aunicorn<\/p>\n<p>\u3067\u52d5\u304b\u3057\u3066\u305f\u3093\u3067\u3059\u304c\u3001EC2\u3092\u518d\u8d77\u52d5\u3057\u3066\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u3001\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n*11 connect() to unix:\/var\/sockets\/XXXXX.sock failed (13: Permission denied) while connecting to upstream, client: X.X.X.X, server: XXXXX.com, request: &amp;quot;GET \/masters HTTP\/1.1&amp;quot;, upstream: &amp;quot;http:\/\/unix:\/var\/sockets\/XXXXX.sock:\/500.html&amp;quot;, host: &amp;quot;XXXXX.com&amp;quot;\n<\/pre>\n<p>\u3063\u3066\u8a00\u308f\u308c\u307e\u3057\u305f\u3002<\/p>\n<h2>\u3084\u3063\u305f\u3053\u3068(\u5931\u6557\u4f8b)<\/h2>\n<p>\u6a29\u9650\u306a\u3044\u306a\u3089\u6a29\u9650\u3064\u3051\u3066\u3084\u308d\u3046\uff01<br \/>\n\u305d\u3082\u305d\u3082\u3069\u3093\u306a\u6a29\u9650\u3067\u52d5\u3044\u3066\u308b\u306e\u304b\u78ba\u8a8d\u3002\u3002\u3002<\/p>\n<p><code>$ ps -ef | grep nginx<\/code><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nroot       839     1  0 04:00 ?        00:00:00 nginx: master process \/usr\/sbin\/nginx -c \/etc\/nginx\/nginx.conf\nnginx      842   839  0 04:00 ?        00:00:00 nginx: worker process\nnginx      943   794  0 04:00 ?        00:00:00 php-fpm: pool www\nnginx      944   794  0 04:00 ?        00:00:00 php-fpm: pool www\nnginx      945   794  0 04:00 ?        00:00:00 php-fpm: pool www\n<\/pre>\n<p><em>nginx<\/em>\u3055\u3093\u3067\u52d5\u3044\u3066\u308b\u306e\u306d\u3002<\/p>\n<p>\u3067\u306f\u554f\u984c\u306e\u30bd\u30b1\u30c3\u30c8\u6a29\u9650\u3092\u78ba\u8a8d\u3057\u3066\u307f\u3088\u3046\u304b\u306a<\/p>\n<p><code>$ ls -l \/var\/sockets\/XXXXX.sock<\/code><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsrwxrwxrwx 1 centos centos 0  9\u6708 20 04:01 \/var\/sockets\/XXXXX.sock\n<\/pre>\n<p>\u3042\u3001\u3042\u308c\uff1f\u3069\u3093\u306a\u6a29\u9650\u3067\u3082\u30aa\u30c3\u30b1\u30fc\u3060\u3002\u3002\u304a\u304b\u3057\u3044\u306a\u3002<br \/>\n\u4e00\u5fdc\u3001nginx\u3092<em>centos<\/em>\u3055\u3093\u3067\u52d5\u304b\u3057\u3066\u307f\u308b\u304b\u3002\u3002<\/p>\n<p><code>$ sudo vi \/etc\/nginx\/nginx.conf<\/code><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#user  nginx;\nuser  centos;\nworker_processes  1;\n<\/pre>\n<p>nginx\u518d\u8d77\u52d5\u3057\u3066Go!!<\/p>\n<p>\u3002\u3002\u3002\u30c0\u30e1\u3067\u3057\u305f\u3002<br \/>\n\u3053\u308c\u3067\u306f\u306a\u3044\u3089\u3057\u3044\u3002<\/p>\n<h2>\u89e3\u6c7a\uff01\uff01\u539f\u56e0\uff01<\/h2>\n<p>SELinux\u3067\u3057\u305f\u3002\u3002<\/p>\n<p>\u307e\u305a\u306f\u72b6\u614b\u78ba\u8a8d<br \/>\n<code>$ getenforce<\/code><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nEnforcing\n<\/pre>\n<p>\u304a\u3049\u3001\u30b4\u30ea\u30b4\u30ea\u306b\u52b9\u3044\u3066\u307e\u3059\u306d\u3002<\/p>\n<p>\u4eca\u56deSELinux\u306f\u7279\u306b\u3044\u3089\u306a\u3044\u306e\u3067\u505c\u6b62\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p><code>$ sudo vi \/etc\/sysconfig\/selinux<\/code><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#SELINUX=enforcing\nSELINUX=disabled\n<\/pre>\n<p>EC2\u518d\u8d77\u52d5\u3057\u3066Go!!<\/p>\n<p>\u30c7\u30ad\u30de\u30b7\u30bf\uff01<\/p>\n<p>\u3075\u3043\u301c\u306f\u307e\u3063\u305f(\u8efd\u304f2\u6642\u9593\u3002\u3002\u3002)<\/p>\n<hr \/>\n<p>\u3061\u306a\u307f\u306b\u52d5\u7684\u306bSELinux\u3092\u7121\u52b9\u306b\u3059\u308b\u65b9\u6cd5<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ setenforce 0\n$ getenforce\nPermissive\n<\/pre>\n<p>\u611f\u8b1d\u30b5\u30a4\u30c8\uff1a<a href=\"http:\/\/server-setting.info\/centos\/socket-permission-denied-resolve.html\">http:\/\/server-setting.info\/centos\/socket-permission-denied-resolve.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3046\u3082\u4e2d\u7530\u3067\u3059\u3002 AWS\u4e0a\u3067API\u30b5\u30fc\u30d0\u3092\u69cb\u7bc9\u3057\u3066\u3066\u3001 * Web\u30b5\u30fc\u30d0\uff1angi &#8230; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[7],"tags":[18,15,23],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.13 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream | \u30b3\u30fc\u30c6\u30c3\u30b0\u306e\u30d0\u30b1\u30c4<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cotegg.com\/blog\/?p=281\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream | \u30b3\u30fc\u30c6\u30c3\u30b0\u306e\u30d0\u30b1\u30c4\" \/>\n<meta property=\"og:description\" content=\"\u3069\u3046\u3082\u4e2d\u7530\u3067\u3059\u3002 AWS\u4e0a\u3067API\u30b5\u30fc\u30d0\u3092\u69cb\u7bc9\u3057\u3066\u3066\u3001 * Web\u30b5\u30fc\u30d0\uff1angi ...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cotegg.com\/blog\/?p=281\" \/>\n<meta property=\"og:site_name\" content=\"\u30b3\u30fc\u30c6\u30c3\u30b0\u306e\u30d0\u30b1\u30c4\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/COTegg.japan\/\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-20T04:24:20+00:00\" \/>\n<meta name=\"author\" content=\"\u4e2d\u7530 \u6b69\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cotegg_japan\" \/>\n<meta name=\"twitter:site\" content=\"@cotegg_japan\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u4e2d\u7530 \u6b69\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.cotegg.com\/blog\/?p=281#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.cotegg.com\/blog\/?p=281\"},\"author\":{\"name\":\"\u4e2d\u7530 \u6b69\",\"@id\":\"https:\/\/www.cotegg.com\/blog\/#\/schema\/person\/bee6afc3e5cc03652345976570794aef\"},\"headline\":\"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream\",\"datePublished\":\"2015-09-20T04:24:20+00:00\",\"dateModified\":\"2015-09-20T04:24:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.cotegg.com\/blog\/?p=281\"},\"wordCount\":151,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.cotegg.com\/blog\/#organization\"},\"keywords\":[\"nginx\",\"rails\",\"unicorn\"],\"articleSection\":[\"\u6280\u8853\"],\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.cotegg.com\/blog\/?p=281#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.cotegg.com\/blog\/?p=281\",\"url\":\"https:\/\/www.cotegg.com\/blog\/?p=281\",\"name\":\"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream | \u30b3\u30fc\u30c6\u30c3\u30b0\u306e\u30d0\u30b1\u30c4\",\"isPartOf\":{\"@id\":\"https:\/\/www.cotegg.com\/blog\/#website\"},\"datePublished\":\"2015-09-20T04:24:20+00:00\",\"dateModified\":\"2015-09-20T04:24:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.cotegg.com\/blog\/?p=281#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.cotegg.com\/blog\/?p=281\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.cotegg.com\/blog\/?p=281#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.cotegg.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.cotegg.com\/blog\/#website\",\"url\":\"https:\/\/www.cotegg.com\/blog\/\",\"name\":\"COTegg\u306e\u30d0\u30b1\u30c4\",\"description\":\"- Bucket of cotegg -\",\"publisher\":{\"@id\":\"https:\/\/www.cotegg.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.cotegg.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.cotegg.com\/blog\/#organization\",\"name\":\"COTegg Inc.\",\"url\":\"https:\/\/www.cotegg.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.cotegg.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.cotegg.com\/blog\/wp-content\/uploads\/2015\/07\/logo_color1_yoko-e1436354651882.png\",\"contentUrl\":\"https:\/\/www.cotegg.com\/blog\/wp-content\/uploads\/2015\/07\/logo_color1_yoko-e1436354651882.png\",\"width\":176,\"height\":60,\"caption\":\"COTegg Inc.\"},\"image\":{\"@id\":\"https:\/\/www.cotegg.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/COTegg.japan\/\",\"https:\/\/twitter.com\/cotegg_japan\",\"https:\/\/www.instagram.com\/cotegg_japan\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.cotegg.com\/blog\/#\/schema\/person\/bee6afc3e5cc03652345976570794aef\",\"name\":\"\u4e2d\u7530 \u6b69\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.cotegg.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ce4d0b00ef87081854562ad73f762659?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ce4d0b00ef87081854562ad73f762659?s=96&d=mm&r=g\",\"caption\":\"\u4e2d\u7530 \u6b69\"},\"sameAs\":[\"http:\/\/www.cotegg.com\"],\"url\":\"https:\/\/www.cotegg.com\/blog\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream | \u30b3\u30fc\u30c6\u30c3\u30b0\u306e\u30d0\u30b1\u30c4","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.cotegg.com\/blog\/?p=281","og_locale":"ja_JP","og_type":"article","og_title":"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream | \u30b3\u30fc\u30c6\u30c3\u30b0\u306e\u30d0\u30b1\u30c4","og_description":"\u3069\u3046\u3082\u4e2d\u7530\u3067\u3059\u3002 AWS\u4e0a\u3067API\u30b5\u30fc\u30d0\u3092\u69cb\u7bc9\u3057\u3066\u3066\u3001 * Web\u30b5\u30fc\u30d0\uff1angi ...","og_url":"https:\/\/www.cotegg.com\/blog\/?p=281","og_site_name":"\u30b3\u30fc\u30c6\u30c3\u30b0\u306e\u30d0\u30b1\u30c4","article_publisher":"https:\/\/www.facebook.com\/COTegg.japan\/","article_published_time":"2015-09-20T04:24:20+00:00","author":"\u4e2d\u7530 \u6b69","twitter_card":"summary_large_image","twitter_creator":"@cotegg_japan","twitter_site":"@cotegg_japan","twitter_misc":{"\u57f7\u7b46\u8005":"\u4e2d\u7530 \u6b69","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"1\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cotegg.com\/blog\/?p=281#article","isPartOf":{"@id":"https:\/\/www.cotegg.com\/blog\/?p=281"},"author":{"name":"\u4e2d\u7530 \u6b69","@id":"https:\/\/www.cotegg.com\/blog\/#\/schema\/person\/bee6afc3e5cc03652345976570794aef"},"headline":"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream","datePublished":"2015-09-20T04:24:20+00:00","dateModified":"2015-09-20T04:24:20+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cotegg.com\/blog\/?p=281"},"wordCount":151,"commentCount":0,"publisher":{"@id":"https:\/\/www.cotegg.com\/blog\/#organization"},"keywords":["nginx","rails","unicorn"],"articleSection":["\u6280\u8853"],"inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.cotegg.com\/blog\/?p=281#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.cotegg.com\/blog\/?p=281","url":"https:\/\/www.cotegg.com\/blog\/?p=281","name":"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream | \u30b3\u30fc\u30c6\u30c3\u30b0\u306e\u30d0\u30b1\u30c4","isPartOf":{"@id":"https:\/\/www.cotegg.com\/blog\/#website"},"datePublished":"2015-09-20T04:24:20+00:00","dateModified":"2015-09-20T04:24:20+00:00","breadcrumb":{"@id":"https:\/\/www.cotegg.com\/blog\/?p=281#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cotegg.com\/blog\/?p=281"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.cotegg.com\/blog\/?p=281#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cotegg.com\/blog"},{"@type":"ListItem","position":2,"name":"\u3010nginx\/unicorn\u3011(13: Permission denied) while connecting to upstream"}]},{"@type":"WebSite","@id":"https:\/\/www.cotegg.com\/blog\/#website","url":"https:\/\/www.cotegg.com\/blog\/","name":"COTegg\u306e\u30d0\u30b1\u30c4","description":"- Bucket of cotegg -","publisher":{"@id":"https:\/\/www.cotegg.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cotegg.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/www.cotegg.com\/blog\/#organization","name":"COTegg Inc.","url":"https:\/\/www.cotegg.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.cotegg.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.cotegg.com\/blog\/wp-content\/uploads\/2015\/07\/logo_color1_yoko-e1436354651882.png","contentUrl":"https:\/\/www.cotegg.com\/blog\/wp-content\/uploads\/2015\/07\/logo_color1_yoko-e1436354651882.png","width":176,"height":60,"caption":"COTegg Inc."},"image":{"@id":"https:\/\/www.cotegg.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/COTegg.japan\/","https:\/\/twitter.com\/cotegg_japan","https:\/\/www.instagram.com\/cotegg_japan\/"]},{"@type":"Person","@id":"https:\/\/www.cotegg.com\/blog\/#\/schema\/person\/bee6afc3e5cc03652345976570794aef","name":"\u4e2d\u7530 \u6b69","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.cotegg.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ce4d0b00ef87081854562ad73f762659?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ce4d0b00ef87081854562ad73f762659?s=96&d=mm&r=g","caption":"\u4e2d\u7530 \u6b69"},"sameAs":["http:\/\/www.cotegg.com"],"url":"https:\/\/www.cotegg.com\/blog\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/281"}],"collection":[{"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=281"}],"version-history":[{"count":1,"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions"}],"predecessor-version":[{"id":282,"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/281\/revisions\/282"}],"wp:attachment":[{"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cotegg.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}