我正在寻找有关客户端Web套接字,Web服务器和实际应用程序后端之间交互的资源,这些后端在CGI,FastCGI或SCGI协议之后工作.
在这一点上,这似乎是不可能的:
请求长度是在CONTENT_LENGTH变量中明确定义的,所以我不能指望数据会继续来自stdin的Web服务器,或者我可以吗?as unset CONTENT_LEGTH定义no-request body.
应用程序需要读取CONTENT_LEGTH更多的日期字节,如果读取的更少,则将其视为断开连接的客户端.
谢谢,所有信息都是合适的.
阿尔乔姆
任何人?
我正在尝试在共享主机(Bluehost)上运行Django.我正在使用需要PIL的功能.PIL从交互式shell导入和工作,但是在我的fcgi进程中,它从PIL导入映像中的MemoryError崩溃.任何有关为什么它可能在fcgi内失败的帮助将非常感激.
__Environment Info__:
Python2.7
Local installs of libjpg, zlib, freetype, and lcms
Virtualenv:
Django 1.3, PIL, flup, etc.
__Stack Trace__:
File ".../feincms_thumbnail.py", line 3, in <module>
from PIL import Image
File ".../PIL/Image.py", line 45, in <module>
\__import__("FixTk")
File ".../python2.7/lib-tk/FixTk.py", line 15, in <module>
import ctypes
File ".../python2.7/ctypes/__init__.py", line 549, in <module>
CFUNCTYPE(c_int)(lambda: None)
__.fcgi__:
<!-- language: python -->
# setup paths
# set DJANGO_SETTINGS_MODULE in os.environ
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用IIS 7.5运行Perl/FastCGI(FCGI).版本C:\Windows\System32\inetsrv\iisfcgi.dll是7.5.7601.17514.这是我web.config和我的Perl脚本:
D:\MiLu\Dev :: more /t1 web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true" />
<handlers>
<add name="FCGI" path="*.pl" verb="*"
modules="FastCgiModule"
scriptProcessor="C:\Opt\Cygwin\bin\perl.exe"
resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
</configuration>
D:\MiLu\Dev :: more /t4 Perl\fcgi\count.pl
use strict;
use warnings;
use FCGI;
my $count = 0;
my $request = FCGI::Request();
while ( $request->Accept >= 0 ) {
print "Content-type: text/html\r\n\r\n", ++$count;
}
Run Code Online (Sandbox Code Playgroud)
所有我得到的是一个带有IIS通用错误页面的500,说明"FastCGI进程意外退出"并列出了可能的错误原因.
脚本从命令行运行正常,打印其三行然后立即退出,表明脚本和模块安装正常.(顺便说一下,我从FCGI手册中复制了它,所以应该没问题.)
D:\MiLu\Dev :: C:\Opt\Cygwin\bin\perl.exe Perl\fcgi\count.pl
Content-type: text/html
1
Run Code Online (Sandbox Code Playgroud)
有一个FCGI::IIS module,但是,它仅出现在IIS …
我期待通过FCGI与使用nginx运行独立的Python脚本,但我不知道从哪里开始产卵的过程.目前,我已成功使用nginx + fcgi的PHP,但我不确定是否/如何使用python执行相同的操作.有关从哪里开始的任何建议?
Perl在FCGI模式下的函数我有一个奇怪的行为.新线不会被追加.为什么会这样?
示例代码:
#!/usr/bin/perl -wT
use strict;
use warnings;
use utf8;
use feature qw( say );
use FCGI ();
use CGI qw( header );
my $cnt = 0;
my $req = FCGI::Request();
while ( $req->Accept() >= 0 ) {
$cnt++;
print header( -type => 'text/plain', -charset => 'utf-8' );
say "Hello, world #$cnt";
print "\n";
print "$$\n"
print 'Test 1234';
}
Run Code Online (Sandbox Code Playgroud)
预期结果(以及通过控制台的实际结果):
Content-Type: text/plain; charset=utf-8
Hello, world. #1
6712
Test 1234
Run Code Online (Sandbox Code Playgroud)
通过Apache/FCGI的实际结果:
Content-Type: text/plain; charset=utf-8
Hello, world. #3
6709
Test 1234 …Run Code Online (Sandbox Code Playgroud) 我在http://fastcgi.com/中使用C++应用程序中的库作为后端,使用nginx web服务器作为前端.
成功发布HTML表单中的文件,可以在nginx服务器端查看临时文件.但我无法弄清楚如何使用fastcgi_stdio访问多部分POST请求的主体.这是我的HTML表单.
<html>
<head>
<title>Test Server</title>
<script src="http://code.jquery.com/jquery.min.js"></script>
</head>
<body>
<form id="upload-form" method="post" target="upload_target" enctype="multipart/form-data" action="/upload">
<input name="file" id="file" size="27" type="file" /><br />
<input type="submit" name="action" value="Upload" /><br />
<iframe id="upload_target" name="upload_target" src="" style="width:100%;height:100px;border:0px solid #fff;"></iframe>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我的nginx conf文件:
location /upload {
# Pass altered request body to this location
upload_pass @test;
# Store files to this directory
# The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should …Run Code Online (Sandbox Code Playgroud) 有什么不同?如果我使用net/http/fcgi包,则每个请求都将在新的goroutine中执行.net/http ListenAndServe似乎是一样的......不是吗?有什么优缺点?
我500 Internal Server在各种共享主机上的基于PHP/MySQL的站点上遇到了随机错误.我在共享的Linux服务器上使用PHP 5.2.17到CGI/FastCGI.当我查看日志时,我看到了这个:
[error] [client 75.71.176.224] (104)Connection reset by peer: FastCGI: comm with server "/dev/shm/blackmou-php.fcgi" aborted: read failed, referer: ...
[error] [client 75.71.176.224] FastCGI: incomplete headers (0 bytes) received from server "/dev/shm/blackmou-php.fcgi", referer: ...
[error] [client 75.71.176.224] (104)Connection reset by peer: FastCGI: comm with server "/dev/shm/blackmou-php.fcgi" aborted: read failed, referer: ...
[error] [client 75.71.176.224] FastCGI: incomplete headers (0 bytes) received from server "/dev/shm/blackmou-php.fcgi", referer: ...
Run Code Online (Sandbox Code Playgroud)
谁知道如何解决这个问题?
我们有一台Windows 2008 R2服务器.我们已经在其上托管了WordPress网站.该网站经常显示500内部错误.在启用详细信息模式时,它提供以下消息:
HTTP错误500.0 - 内部服务器错误最近FastCGI进程频繁失败.请稍后再试一次.
重置服务器启动网站.
这个问题经常发生,我们无法找到有关原因的任何进一步信息.我们都无法复制这个问题.
我们在php.ini中启用了sysloging,但无济于事.
所以我有一个Ubuntu服务器,我试图从备份恢复.当一个虚拟的PHP版本页面,我得到502 Bad Gateway.我试图修复它的是什么?相当多的事情,包括这个相关问题的答案 - nginx 502坏网关
这是我使用Ubuntu的默认配置
server {
listen 80;
# listen [::]:81 ipv6only=on default_server;
root /var/www/html;
index index.php index.html index.htm;
server_name localhost;
location ~* \.(js|css|png|jpg|jpeg|gif|ico|html)$ {
expires max;
}
location / {
try_files $uri $uri.php $uri.php/$args /index.php?q=$uri&$args $uri/ =404;
index index.php index.html index.htm;
rewrite ^(.*)$ /$1.php;
}
location /phpmyadmin {
index index.php;
try_files $uri $uri/ =404;
auth_basic "Admin Login";
auth_basic_user_file /etc/nginx/pma_pass;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} …Run Code Online (Sandbox Code Playgroud)