title: AH01114: HTTP: failed to make connection to backend: localhost (apache as docker container)
body: <p>I am trying to setup apache in front of a server application (JIRA) on my local machine. Somewhat based on:
  <a href="https://mimiz.github.io/2017/05/18/Configure-docker-httpd-image.html" rel="nofollow noreferrer">https://mimiz.github.io/2017/05/18/Configure-docker-httpd-image.html</a></p>
  
  <p>Both apache and the server application are run as docker containers.</p>
  
  <p>Starting my server application works fine and I can access the web-ui at:</p>
  
  <pre><code>http://localhost:8087
  </code></pre>
  
  <p>But when I start apache and try to access it in my browser:</p>
  
  <pre><code>http://localhost:80
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>Service Unavailable
  </code></pre>
  
  <p>and when I look at the logs it says:</p>
  
  <pre><code>H00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.18.0.5. Set the 'ServerName' directive globally to suppress this message
  [Mon Apr 01 09:08:50.408757 2019] [mpm_event:notice] [pid 1:tid 140140879032384] AH00489: Apache/2.4.38 (Unix) configured -- resuming normal operations
  [Mon Apr 01 09:08:50.409320 2019] [core:notice] [pid 1:tid 140140879032384] AH00094: Command line: 'httpd -D FOREGROUND'
  [Mon Apr 01 09:09:53.094495 2019] [proxy:error] [pid 8:tid 140140638869248] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:8087 (localhost) failed
  [Mon Apr 01 09:09:53.094571 2019] [proxy_http:error] [pid 8:tid 140140638869248] [client 172.18.0.1:53110] AH01114: HTTP: failed to make connection to backend: localhost
  </code></pre>
  
  <p>This is <strong>httpd.conf</strong> details I have enabled/added:</p>
  
  <pre><code>LoadModule proxy_module modules/mod_proxy.so
  #LoadModule proxy_connect_module modules/mod_proxy_connect.so
  #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
  LoadModule proxy_http_module modules/mod_proxy_http.so
  ...
  
  &lt;VirtualHost *:80&gt;
    ServerName www.app1.lol
    ProxyPass / http://localhost:8087
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>And this is how I start my server application:</p>
  
  <pre><code>docker run --network sample-network -p 0.0.0.0:8087:8087 -ti -d --name my-server-container my-server-image
  </code></pre>
  
  <p>And this is how I start apache:</p>
  
  <pre><code>docker run -d -p 80:80 --network sample-network --name my-apache-container my-apache-image
  </code></pre>
  
  <p>Is the problem my configuration in the <strong>httpd.conf</strong> file or in the docker run commands (or a combination of both)?</p>