当前位置:   article > 正文

The specified CGI application misbehaved by not returning a complete set of HTTP headers

the specified cgi application misbehaved by not returning a complete set of

今天部署华为云,提示如下错误:
HTTP Error 502.2 - Bad Gateway
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "<b>Security Alert!</b> The PHP CGI cannot be accessed directly. <p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.</p> <p>For more information as to <i>why</i> this behaviour exists, see the <a href="http://php.net/security.cgi-bin">manual page for CGI security</a>.</p> <p>For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit <a href="http://php.net/install.windows">the manual page</a>.</p> ".
-----------------------------
大意是说指定的 CGI 应用程序由于未返回完整的一组 HTTP 头而产生错误行为。
-----------------------------
服务器:
系统:Microsoft Windows Server 2019 Datacenter
版本:10.0.17763 N/A Build 17763
-----------------------------
解决方案:
一、微软下载安装 vc_redist.x64.exe 包:
    https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170
-----------------------------
二、设置服务器显示详细错误:
<system.web>
    <customErrors mode="Off" />
</system.web>
<system.webServer>
    <httpErrors errorMode="Detailed" />
</system.webServer>
-----------------------------
三、关闭 php.ini 中的强制重定向项(它可以防止当PHP运行的CGI脚本未经验证的访问)
    cgi.force_redirect = 0
    
    官方描述:
    cgi.force_redirect bool
    cgi.force_redirect is necessary to provide security running PHP as a CGI under most web servers. Left undefined, PHP turns this on by default. You can turn it off at your own risk.
    Note:
    Windows Users: When using IIS this option must be turned off. For OmniHTTPD or Xitami the same applies.

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号