Boa服务器返回 502 Bad Gateway .The CGI was not CGI/1.1 compliant. 错误,解决方案
来源:互联网 发布:知茵是否有网上旗舰店 编辑:程序博客网 时间:2024/06/05 03:40
对写的CGI程序进行测试时,进行get请求时没问题,进行post请求时,出现如下错误:
一般情况下,CGI程序有问题则会出现上述问题。查了很多网上的帖子,最终发现是自己CGI程序中处理POST请求时的输入流代码有错误,将错误代码进行修改即可解决问题。
总结网上出现这种问题的各种解决方案,以备日后查看:
1、改变CGI程序的权限 chmod 755 或者777 (经常容易被忽略的一个因素)
2、CGI程序中写响应头的时候不能丢了 “\n\n” 两个换行符,可以有以下两种方式输出响应头:
- printf(“Content-Type:text/html\n\n”);
- printf(“Content-Type:text/html%c%c”,10,10);
以下转自:http://www.cnblogs.com/hnrainll/archive/2011/06/01/2067266.html
一,在var/www中打开了基本信息设置这个html文件,然后表单内容提交给comment.cgi,又是出现了404,not found,The requested URL /var/www/cgi-bin/comment.cgi was not found on this server。本次问题出在不能用汉字。把html文件中的汉字改成英文后404问题消失。
二,测试cgi时可能出现问题 502 Bad Gateway
The CGI was not CGI/1.1 compliant.
解决:
1,修改boa代码cgi.c,在 complete_env 函数中添加环境变量
my_add_cgi_env(req, “LD_LIBRARY_PATH”, “/lib”),然后重新make即可;
2,编译时加入一个参数,具体如下:
gcc -static test.c -o test.cgi
3,有时原因可能是出在 req->post_data_fd上,在cgi.c的ini_cgi()中,在进行fork()之后,父行程会将 req->post_data_fd关闭设为零,在别的系统中这不会影响到子进程,不过不知道为什么在uclinux下就会出问题,试试把
if (req->method == M_POST)
{
close(req->post_data_fd); /* child closed it too */
req->post_data_fd = 0;
}
里的req->post_data_fd = 0,注释掉看看;
4,boa对实现动态网页的CGI的支持存在一些缺陷,解析CGI应答头时不能完整处理status和location。在此借鉴了http://bbs.chinaunix.net/viewthread.php?tid=824840&pid=5747073&page=1,对整个cgi_header.c进行的修改。
- Boa服务器返回 502 Bad Gateway .The CGI was not CGI/1.1 compliant. 错误,解决方案
- 嵌入式boa服务器:502 Bad Gateway The CGI was not CGI/1.1 compliant.
- Boa应用中报错:502 Bad Gateway The CGI was not CGI/1.1 compliant.
- 502 Bad Gateway The CGI was not CGI/1.1 compliant
- The CGI was not CGI/1.1 compliant. 解决之道
- php-cgi导致的502 Bad Gateway错误
- boa服务器CGI相关的一些错误解决方法
- boa,cgi 应用过程经验总结(404,502错误解决)
- The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server
- The requested URL /nagios/cgi-bin/statusmap.cgi was not found on this server
- 嵌入式WEB服务器BOA和CGI
- 嵌入式WEB服务器BOA和CGI
- 嵌入式WEB服务器BOA和CGI
- 嵌入式WEB服务器BOA和CGI
- cgi配合boa使用web服务器
- 【后台】嵌入式服务器Boa和CGI
- CGI 问题:502 bad gateway以及生成文件过大的处理
- 解决php-cgi假死导致页面出现502 Bad gateway问题
- <blockquote>标签,长文本引用
- Mybatis级联查询对象为null
- 简析SynchronousQueue,LinkedBlockingQueue,ArrayBlockingQueue
- lintcode_快乐数
- webview的使用及常见的问题
- Boa服务器返回 502 Bad Gateway .The CGI was not CGI/1.1 compliant. 错误,解决方案
- HTTP协议—— 简单认识TCP/IP协议
- js之DOM深入学习总结
- 一个简单的UDP程序—C++服务器和C# .NET客户端
- Convert BST to Greater Tree
- 如何使用secureCRT连接vmware中的虚拟主机?
- 特征提取资源链接
- amlogic S905X udpate imge的压缩和解压
- PHP的类和对象