Articles of fastcgi

当使用nginx和fastcgi时,Django @login_required会导致redirect循环

我在settings.py中像这样设置了LOGIN_URL: LOGIN_URL = '/login/' 并在urls.py我和这URLConf: (r'^$', 'agent.index.redirect'), (r'^login/$', 'django.contrib.auth.views.login', {'template_name':'login.html'}), 和agent.index.redirect视图是这样的: @login_required def redirect(request): … 我运行我的Django网站是这样的: python manage.py runfcgi host=127.0.0.1 port=8090 –settings=settings nginx.conf是这样的: user nobody nobody; worker_processes 5; #error_log /var/log/nginx/error_log info; events { worker_connections 1024; use epoll; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] ' '"$request" $status $bytes_sent ' […]

nginx + fast-cgi – 如何让phpmyadmin工作

我configuration了我的nginx服务器+ php。 除了phpmyadmin以外,其他所有的东西都可以正常工作。 我GOOGLE了很多,发现一些别名技巧,但他们没有对我工作。 这很好: location ~ ^/ololo/(.*\.php)$ { alias $root_path/img/$1; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; } location /ololo/ { alias $root_path/img/; index index.php; } 有我的网站pathimg目录,当我请求sitename/ololo/或sitename/ololo/index.php一切都很好。 但那: location ~ ^/myadmin/(.*\.php)$ { alias /usr/share/phpmyadmin/$1; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; } location /myadmin/ { alias /usr/share/phpmyadmin/; index index.php; } […]

fastcgi单声道套接字(nginx:拒绝访问)

我有一个Ubuntu的(13.04)/ Nginx的/单声道设置。 它的工作原理是当我设置fastcgi-mono-server4上的套接字到TCP,但是我想使用套接字。 我用启动时运行的这个脚本启动它: #!/bin/sh ### BEGIN INIT INFO # Provides: monoserve.sh # Required-Start: $local_fs $syslog $remote_fs # Required-Stop: $local_fs $syslog $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start fastcgi mono server with hosts ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/mono NAME=monoserver DESC=monoserver MONOSERVER=$(which fastcgi-mono-server4) MONOSERVER_PID=$(ps auxf | grep […]

Nginx + fastcgimultithreading

你好,我一直在试图做fastcgi应用程序,我希望它是multithreading的,所以它可以处理大量的请求在同一时间。 我find了代码,并修改了一下 FCGX_InitRequest(&request, 0, FCGI_FAIL_ACCEPT_ON_INTR); for (;;) { static pthread_mutex_t accept_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t counts_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&accept_mutex); rc = FCGX_Accept_r(&request); pthread_mutex_unlock(&accept_mutex); … … … FCGX_FPrintF(request.out,"%s",test_stream.str().c_str()); FCGX_Finish_r(&request); } 代码一直在接受,所以实际上等待,直到请求完成。 我试过像这样产卵fastcgi spawn-fcgi -p 8001 -U www-data -n handler.cgi -F 32 spawn-fcgi -p 8001 -U www-data -n handler.cgi — /usr/bin/multiwatch -F 32

如何通过NGINX在C中的FCGI服务器之间传递自定义参数?

介绍 我的FastCGI服务器是用C编写的。我希望FCGI auth服务器将一些自定义参数(比如由Radius服务器返回的一些参数)传递给FCGI "back-end"服务器。 我的问题 NGINX是否支持在C中两个FCGI服务器之间传递自定义参数? 如果是的话,我将不胜感激在以下方面的一些帮助: 如何编程FCGIauthentication服务器将variables传递给NGINX。 如何编程FCGI后端服务器来读取自定义参数 如何configurationnginx.conf文件。 在我的例子下面,我有“fastcgi_param CUSTOM_PARAM custom_param;”。 我不知道这是否是这样做的,我走了如何完成一个HTTP头参数。 工作 这是我的。 FCGI / auth服务器将设置custom_param variable ,我希望NGINX将这个variables转发给FCGI后端服务器。 location / { auth_request /auth; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; } location = /auth { include fastcgi_params; fastcgi_param CUSTOM_PARAM custom_param; fastcgi_pass 127.0.0.1:9010; } 谢谢你的帮助!

nginx FastCGI-剥离位置前缀?

我正在使用web.py,spawn_fcgi和nginx编写一个Python应用程序。 假设我在nginx中有这个configuration块: location / { include fastcgi.conf; fastcgi_pass 127.0.0.1:9001; } 如果我访问http://example.com/api/test ,则FastCGI应用程序将接收/api/test作为请求位置。 当确定要执行哪个类时,web.py框架将使用这个位置。 例如: urls = ( "/api/.*", myClass ) 如果我需要将这个脚本放在网站上的其他位置,问题就来了。 例如: location /app { include fastcgi.conf; fastcgi_pass 127.0.0.1:9001; } 现在,当我访问http://example.com/app/api/test ,FastCGI应用程序获取/app/api/test作为它的位置。 它当然可以位于任何地方: http://example.com/sloppy_admin/My%20Web%20Pages/app/api/test : http://example.com/sloppy_admin/My%20Web%20Pages/app/api/test例如。 🙂 我希望应用程序可以重定位,因为在其他服务器上安装它可能是必要的(例如,它必须与其他服务器共享服务器)。 坚持每台服务器都放在同一个“虚拟子目录”中似乎有点头痛。 现在,我的解决方法是做这样的事情: URL_PREFIX = "/app" # the same as the nginx location parameter urls = ( URL_PREFIX+"/api/.*",myClass […]

Nginx,fastcgi PHP Windows,没有指定input文件

在端口9000上运行php-cgi Netstat给我 TCP 127.0.0.1:9000 DESKTOP-xxxxxxx:0 LISTENING [php-cgi.exe] nginx.conf http://pastebin.com/wkfz8wxw 每个php文件都给我这个No input file specified. 错误… 将SCRIPT_FILENAME更改为SCRIPT_NAME ,但没有成功 我在Windows 10 Home x64上

django – nginx + fastcgi – >未处理的exception(从Django 1.2.4升级到Django 1.3后)

我刚刚从django 1.2.4升级到1.3。 我正在使用nginx与fastcgi结合,由于某种原因每当我访问一个页面时,我得到这个错误: Unhandled Exception An unhandled exception was thrown by the application. 任何想法可能是什么问题?

在Nginx上安装wordpress – Nginx发送install.php

我试图configurationNginx的服务wordpress安装(和一个rails应用程序 – 但这不是问题)。 我有一个奇怪的问题:我设法让PHP工作正常(一个基本的test.php被正确parsing),但是当我想安装wordpress时,Nginx 发送给我 install.php文件 – 我可以下载它。 这是Nginx所做的唯一一个文件:其他的wordpress文件也是如此,并且redirect到install.php的时间更多。 我在Gentoo上。 我使用spawn-fcgi工作,这里是我的nginx.conf。 有关部分是第二个服务器(wp.domain.local): user nginx nginx; worker_processes 1; error_log /var/log/nginx/error_log info; events { worker_connections 1024; use epoll; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] ' '"$request" $status $bytes_sent ' '"$http_referer" "$http_user_agent" ' '"$gzip_ratio"'; client_header_timeout 10m; client_body_timeout 10m; send_timeout 10m; connection_pool_size […]

在FastCGI应用程序中无法获得HTTP POST的正文

我使用C ++应用程序中的http://fastcgi.com/作为后端,使用nginxnetworking服务器作为前端。 从HTML表单成功发布1MB文件和variables“CONTENT_LENGTH”足够大:)但我不知道如何使用libfcgi访问POST请求的主体。 这是我的HTML格式,它的效果很好。 <form action="/upload" enctype="multipart/form-data" method="POST"> <input type="test" name="text1" /> <input type="file" name="file1" /> <input type="submit" /> </form> 要求被接受通过 int FCGX_Accept_r(FCGX_Request *request); 在FCGX_Request内部,我们有3个stream:进出,错误。 “in”stream的标志isReader == 1,其他的isReader == 0。 typedef struct FCGX_Stream { unsigned char *rdNext; /* reader: first valid byte * writer: equals stop */ unsigned char *wrNext; /* writer: first free byte […]