<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="86808" data-post-id="86808">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="SZJX" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  SZJX
                      <span class="op-star" title="Thread Starter">
                        <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                      </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Turns out I didn’t properly read the error log (They have suffixes such as <code>06-28</code> and I just tried to read the most recent one which contained nothing). The error is “Permission Denied” when Nginx was trying to connect to the Cowboy server, which was already asked here: <a href="https://stackoverflow.com/questions/23948527/13-permission-denied-while-connecting-to-upstreamnginx" rel="noopener nofollow ugc">https://stackoverflow.com/questions/23948527/13-permission-denied-while-connecting-to-upstreamnginx</a>. The solution is to change <code>httpd</code> setting in SELinux: <code>setsebool -P httpd_can_network_connect 1</code>. HAProxy isn’t restricted by this setting on <code>httpd</code>, apparently.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="86808" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/phoenix-app-runs-but-nginx-returns-502-error/14877/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-86808" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="86808"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-solved cat-solved" title="Marked as solution"></div>
  </section>
</div>
    <div class="postbit" id="86975" data-post-id="86975">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="SZJX" data-post="12" data-topic="14877">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/s/f17d59/48.png" class="avatar"> SZJX:</div>
<blockquote>
<p>HAProxy isn’t restricted by this setting on <code>httpd</code> , apparently.</p>
</blockquote>
</aside>
<p>That sounds unsafe…</p>
<p>But yeah, if you have selinux enabled then it is pretty obvious that you need to allow the connection…  ^.^;</p>
<p>A quick set of commands that would generally work in this case would be something like:</p>
<pre data-code-wrap="zsh"><code class="lang-zsh"># See what it will enable:
sudo cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -m nginxlocalconf &gt; nginxlocalconf.te
view nginxlocalconf.te

# If the above is good then commit the changes:
sudo cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M nginxlocalconf
sudo semodule -i nginxlocalconf.pp

# See what is allowed to httpd by:
sudo semanage port -l | grep http

# You can add a specific port, like say 6080, by something like:
sudo semanage port -a -t http_port_t -p tcp 6080
</code></pre>
<p>In essence, if one does not know selinux decently, don’t use it unless required (though it is worth learning, it is very powerful).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="86975" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/phoenix-app-runs-but-nginx-returns-502-error/14877/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-86975" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="86975"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>