title: Apache: multiple virtual hosts and reverse proxy
body: <p>I'm trying to configure an Apache server to handle multiple virtual hosts and expose them using reverse proxy.</p>
  <p>In the httpd-vhosts file I've written:</p>
  <pre><code>&lt;VirtualHost *:80&gt;
    ServerName localhost
    ServerAlias localhost
    DocumentRoot &quot;${INSTALL_DIR}/www&quot;
   &lt;Directory &quot;${INSTALL_DIR}/www/&quot;&gt;
      Options +Indexes +Includes +FollowSymLinks +MultiViews
      AllowOverride All
      Require local
    &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:8080&gt;
      ServerName temp
      DocumentRoot &quot;c:/users/test/sites/testsite&quot;
      &lt;Directory  &quot;c:/users/test/sites/testsite&quot;&gt;
          Options +Indexes +Includes +FollowSymLinks +MultiViews
          AllowOverride All
          Require all granted
      &lt;/Directory&gt;
  
      ProxyPreserveHost On
      &lt;Proxy&gt;
          Order deny,allow
          Allow from all
      &lt;/Proxy&gt;
      ProxyPass &quot;temp:8080&quot; &quot;http://my.domain.com/&quot;
      ProxyPassReverse &quot;temp:8080&quot; &quot;http://my.domain.com/&quot;
  &lt;/VirtualHost&gt;
  </code></pre>
  <p>I would like that when I connect to my server through &quot;http://my.domain.com/&quot;, the client connects to the temp virtual server, while when connecting to &quot;localhost&quot; I still connect to the localhost server.
  But this configuration doesn't work. I can connect locally to localhost and to &quot;http://temp:8080&quot;, but I cannot connect through &quot;http://my.domain.com/&quot;.</p>
  <p>If I comment the first VirtualHost, and I configure the second one to listen port 80, I can connect using &quot;http://my.domain.com/&quot; (but in this way, the reverse proxy is useless: if I omit that part, it works anyway), but locally I cannot connect to &quot;localhost&quot; (obviouslly).</p>
  <p>How can I fix this?
  Thank you</p>