title: Apache websocket setup
body: <p>I'm trying to set up websocket on my local machine to test it but I simply can't get it to work, nor find any guide that actually solves it.</p>
  
  <p>So to sum up, can anyone tell me what's wrong with my settings?</p>
  
  <p>I'm running Ububtu 16.04 and Apache 2.4.18
  I have mod_proxy and mod_proxy_wstunnel enabeled</p>
  
  <p>my Apache config looks like this</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName socket.localhost
  
      ProxyRequests Off
      ProxyPass "/ws2/"  "ws://localhost:8546/"
      ProxyPass "/wss2/"  "wss://localhost:8546/"
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>On the client side I have this javaScript</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var socket = new WebSocket('ws://socket.localhost');
      socket.send('Test');
  &lt;/script&gt;
  </code></pre>
  
  <p>And I'm running</p>
  
  <pre><code>netcat -p 8546 -l
  </code></pre>
  
  <p>To see any connection</p>
  
  <p>And lastly I have this line in my hosts file</p>
  
  <pre><code>127.0.0.1   socket.localhost
  </code></pre>
  
  <p>Whenever I run the JavaScript I get the error</p>
  
  <pre><code>Firefox can’t establish a connection to the server at ws://socket.localhost/.
  </code></pre>