title: 502 Plesk connect() to unix:/var/run/sw-engine.sock failed- Ubuntu
body: <p>I work in hosting and have the unfortunate disadvantage of troubleshooting customer's Plesk installs.  I have noted 4 separate server have the same issue over the last hour.</p>
  
  <h1>Identification:</h1>
  
  <p>This can be identified by:</p>
  
  <p><code>tail -n 2 /var/log/sw-cp-server/error_log</code></p>
  
  <p>If you see output similar to the following then you have this issue:</p>
  
  <pre><code>user@hostname:~# tail -n 2 /var/log/sw-cp-server/error_log
  2016/12/15 04:51:17 [crit] 2318#0: *2867 connect() to unix:/var/run/sw-engine.sock failed (2: No such file or directory) while connecting to upstream, client: 10.10.10.10, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/sw-engine.sock:", host: "123.45.67.89:8443"
  2016/12/15 05:23:16 [crit] 2318#0: *2872 connect() to unix:/var/run/sw-engine.sock failed (2: No such file or directory) while connecting to upstream, client: 10.10.10.10, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/sw-engine.sock:", host: "123.45.67.89:8443"
  user@hostname:~#
  </code></pre>
  
  <p><strong>See below for resolution</strong></p>
  
  <p>Other useful articles that I touched while looking into this:</p>
  
  <p><a href="https://kb.plesk.com/en/118973" rel="nofollow noreferrer">https://kb.plesk.com/en/118973</a> - Cannot open File Manager: "502 bad gateway"</p>
  
  <p>Cause </p>
  
  <ul>
  <li>The issue is triggered by the existence of a large number of files in the directory that you tried to open.</li>
  </ul>
  
  <p><a href="https://kb.plesk.com/en/123072" rel="nofollow noreferrer">https://kb.plesk.com/en/123072</a> - Cannot open File Manager: "502 bad gateway"</p>
  
  <p>Cause</p>
  
  <ul>
  <li>Misconfigured startup links</li>
  </ul>
  
  <p><a href="https://kb.plesk.com/en/123735" rel="nofollow noreferrer">https://kb.plesk.com/en/123735</a> - Plesk sw-engine is unavailable after each reboot on Ubuntu</p>
  
  <p>Cause</p>
  
  <ul>
  <li>Web server configuration files are corrupted or absent.</li>
  </ul>