title: Can't connect to my Ratchet / WebSocket Server
body: <p>I've been trying to get my WebSocket server (using Ratchet in PHP) running for the better part of the day, I feel like I've tried everything and still no luck. When I try and connect to the WebSocket server in JS it just takes ages and then it times out, essentially, the server accepts the connection (I don't immediately get a connection refused error) but then does nothing.</p>
  
  <p>I'm running a 14.04 Ubuntu with a LEMP stack. I have found loads of nginx configurations to make this work, but none of them worked for me. The strange thing is that it works perfectly fine locally with my Virtual Machine, which is running a LEMP stack as well, with virtually the same nginx configuration. I never needed to configure anything in my nginx to make websockets work.</p>
  
  <p>A very basic Ratchet example I've been using to test this: <a href="http://socketo.me/docs/hello-world" rel="nofollow">http://socketo.me/docs/hello-world</a></p>
  
  <p>I'm completely lost, and any help would be really appreciated!</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Okay, so I figured out that I needed to set my proxy_pass on a different path than the root path in order for it to work. So originally I had this:</p>
  
  <pre><code>location / {
      proxy_pass http://localhost:1111;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
  
      try_files $uri $uri/ /index.php?$query_string;
  }
  </code></pre>
  
  <p>But not that I changed it to this, it's working:</p>
  
  <pre><code>location /ws/ {
      proxy_pass http://localhost:1111;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
  }
  
  location / {
      try_files $uri $uri/ /index.php?$query_string;
  }
  </code></pre>
  
  <p>However, I'd still like to configure it so that it uses the root url, if that is possible (I mean, it should be since on my local Homestead machine it does work on the root path)</p>