bash fastcgi输出内容类型

使用bash写fastcgi程序时,一定要先输出Content-type和一个空行,不然nginx会报错502 Bad Gateway,后台访问日志中会有”upstream prematurely closed FastCGI stdout while reading response header from upstream”错误。

下面两种写法皆可:

#!/bin/bash echo -e "Content-type: text/html\n"

或者

#!/bin/bash echo "Content-type: text/html"echo ""

之后可以继续输出text或者html文本

bash fastcgi输出内容类型

相关文章:

你感兴趣的文章:

标签云: