{"id":1929,"date":"2020-05-07T17:06:22","date_gmt":"2020-05-07T14:06:22","guid":{"rendered":"https:\/\/artem.services\/?p=1924"},"modified":"2020-05-07T17:35:18","modified_gmt":"2020-05-07T14:35:18","slug":"1929","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=1929&lang=en","title":{"rendered":"FIX ERROR &#8212; CentOS+Nginx+Jenkins: 502 Bad Gateway"},"content":{"rendered":"<p>When running <strong>Nginx<\/strong> as a reverse proxy to <strong>Jenkins<\/strong> on <strong>CentOS<\/strong>, a <strong>502<\/strong> error may occur. <strong>Nginx<\/strong> error log will be as follows:<\/p>\n<blockquote><p>2020\/05\/07 13:32:33 [crit] 9665#9665: *1 connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream, client: 1.2.3.4, server: jenkins.artem.services, request: &quot;GET \/ HTTP\/1.1&quot;, upstream: &quot;http:\/\/127.0.0.1:8080\/&quot;, host: &quot;jenkins.artem.services&quot;<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h3>Solution:<\/h3>\n<p>Reason <strong>SELinux<\/strong>. You can either allow <strong>Jenkins<\/strong> or disable <strong>SELinux<\/strong>.<\/p>\n<h4>Option to disable SELinux<\/h4>\n<p>Open the configuration file:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nvim \/etc\/selinux\/config\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>And change &quot;<strong>enforcing<\/strong>&quot; to &quot;<strong>disabled<\/strong>&quot;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nSELINUX=disabled\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>And restart the server.<\/p>\n<p>In <strong>CentOS 6<\/strong>, you can disable <strong>SELinux<\/strong> without rebooting (<strong>CentOS 7\/8<\/strong> &#8212; require a reboot) by running the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\necho 0 &gt; \/selinux\/enforce\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When running Nginx as a reverse proxy to Jenkins on CentOS, a 502 error may occur. Nginx error log will be as follows: 2020\/05\/07 13:32:33 [crit] 9665#9665: *1 connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream, client: 1.2.3.4, server: jenkins.artem.services, request: &quot;GET \/ HTTP\/1.1&quot;, upstream: &quot;http:\/\/127.0.0.1:8080\/&quot;, host: &quot;jenkins.artem.services&quot; &nbsp; Solution: Reason SELinux. &hellip; <a href=\"https:\/\/artem.services\/?p=1929&#038;lang=en\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c<span class=\"screen-reader-text\"> &quot;FIX ERROR &#8212; CentOS+Nginx+Jenkins: 502 Bad Gateway&quot;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[357],"tags":[1601,1603,855,1261,361,365,617,345,1605],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1929"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1929"}],"version-history":[{"count":3,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1929\/revisions"}],"predecessor-version":[{"id":1932,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1929\/revisions\/1932"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}