「筆記」 解決 CentOS + Plesk 出現 Internal error ;-P 錯誤訊息

建置環境

Linode 4GB + CentOS

$20/mo($.03/hr)
4 GB RAM
2 CPU Cores
48 GB SSD Storage
3 TB Transfer
40 Gbps Network In
1000 Mbps Network Out

登入 Plesk 控制台「網站與域名」出現 Internal error ;-P 以及以下訊息:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>502 Bad Gateway</title>
    <link rel="stylesheet" href="/error_docs/styles.css">
  </head>
  <body>
    <div class="page">
      <div class="main">
        <div class="error-description">
          <h1>Server Error</h1>
          <div class="error-code">502</div>
          <h2>Bad Gateway</h2>
          <p class="lead">Web server received an invalid response while acting as a gateway or proxy server.</p>
          <hr/>
          <p>If you think this is an error, please <a href="https://www.plesk.com/bug-report/" target="_blank">let us know</a> so we can fix it!</p>
          <p>That's what you can do</p>
          <div class="help-actions">
            <a href="javascript:location.reload();">Reload Page</a>
            <a href="javascript:history.back();">Back to Previous Page</a>
            <a href="/">Home Page</a>
          </div>
        </div>
        <div class="help-links">
          <a href="https://www.plesk.com/bug-report/" class="help-link" title="Report a problem" target="_blank">
            <div class="icon report"><svg><use xlink:href="/error_docs/symbols.svg#report"></use></svg></div>
          </a>
          <a href="https://docs.plesk.com/" class="help-link" title="Documentation" target="_blank">
            <div class="icon documentation"><svg><use xlink:href="/error_docs/symbols.svg#documentation"></use></svg></div>
          </a>
          <a href="https://kb.plesk.com/" class="help-link" title="Knowledge base" target="_blank">
            <div class="icon knowledge-base"><svg><use xlink:href="/error_docs/symbols.svg#knowledge-base"></use></svg></div>
          </a>
          <a href="https://talk.plesk.com/" class="help-link" title="Forum" target="_blank">
            <div class="icon forum"><svg><use xlink:href="/error_docs/symbols.svg#forum"></use></svg></div>
          </a>
          <a href="https://www.youtube.com/channel/UCeU-_6YHGQFcVSHLbEXLNlA" class="help-link" title="YouTube" target="_blank">
            <div class="icon youtube"><svg><use xlink:href="/error_docs/symbols.svg#youtube"></use></svg></div>
          </a>
          <a href="https://www.facebook.com/Plesk" class="help-link" title="Facebook" target="_blank">
            <div class="icon facebook"><svg><use xlink:href="/error_docs/symbols.svg#facebook"></use></svg></div>
          </a>
        </div>
      </div>
    </div>
    <script defer src="/error_docs/svgxuse.min.js"></script>
  </body>
</html>

其他症狀

  • 檔案存在但網站顯示 502 Bad Gateway 或 404 Not Found
  • 網站嘗試透過 HTTPS 連接或重新導向到其他網站時顯示 502 Bad Gateway
  • Apache 服務正在運行

原因

Web 服務器設定檔已損壞、不存在或模組未載入

解決方法

停用 Nginx 服務:

# /usr/local/psa/admin/bin/nginxmng --disable

將所有 vhost 的設定檔從 /etc/nginx/plesk.conf.d/vhosts 移動到臨時目錄:

#mkdir / root / support_plesk && mv /etc/nginx/plesk.conf.d/vhosts/* / root / support_plesk

啟動 Nginx 服務:

# /usr/local/psa/admin/bin/nginxmng --enable
# /usr/local/psa/admin/bin/nginxmng --status
Enabled

或使用 Plesk 介面:

Plesk 控制台 > 工具與設定 > 服務管理 > 反向代理伺服器(nginx) > 停止服務 > 啟動服務

確定 Apache 模組 cgid 已經啟用:

Plesk 控制台 > 工具和設定 > Apache Web 伺服器

comments powered by Disqus