Welcome! Log In Create A New Profile

Advanced

Re: need help calling PHP as a fallback

Claude Bing
January 05, 2010 12:22AM
Is proxy_pass supposed to call something with a .eve extension?

On Jan 4, 2010 11:50 PM, "davvv" <nginx-forum@nginx.us> wrote:

I wrote a very scalable HTTP event server in C++ and I would like to make it
work with nginx.
My server is on port 9001, PHP-FPM is running on port 9000.

My server is set up to return a 504 error when an event is found, and the
504 error should trigger the PHP backend.
I've been trying to figure out a way to make it work with nginx and it's
something so elementary, I think I'm just being really stupid.. so I need
some help.

This is basically a short rundown of what happens.
A client hits something like myhost.com/event/, and hangs until there is an
event to server, expiring after 30 seconds by default (if it expires, my
server returns a "NO EVENT" reply, which works); however, if there IS an
event, my server is set up to kick off the client, triggering a 504. Somehow
I want to catch that 504, and redirect the client to a PHP backend (with the
query intact).

This is what I have so far. I haven't worked much with nginx so bear with
me...

location /event/ {
proxy_pass http://localhost:9001/callback.eve;
proxy_intercept_errors on;
error_page 504 = @fallback; #if I straight up put backend.php
here, the POST/GET variables disappear
}

location @fallback {
internal;
fastcgi_param SCRIPT_FILENAME $document_root/backend.php;
fastcgi_param QUERY_STRING $query_string;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}

I get some really strange results with the aforementioned config.. nginx
doesn't break, I don't get an error or anything. PHP doesn't break either.
All I get is a blank page (as in, totally blank) with a 200 OK code. I'm
really confused here, and I'm almost certain there has to be an easy way of
doing this

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,36944,36944#msg-36944


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

need help calling PHP as a fallback

davvv January 04, 2010 11:47PM

Re: need help calling PHP as a fallback

Claude Bing January 05, 2010 12:22AM

Re: need help calling PHP as a fallback

davvv January 05, 2010 12:37AM

Re: need help calling PHP as a fallback

Claude Bing January 05, 2010 12:44AM

Re: need help calling PHP as a fallback

davvv January 05, 2010 12:47AM

Re: need help calling PHP as a fallback

Piotr Sikora January 05, 2010 01:04AM

Re: need help calling PHP as a fallback

davvv January 05, 2010 01:25AM

Re: need help calling PHP as a fallback

Rob Schultz January 05, 2010 01:36AM

Re: need help calling PHP as a fallback

Piotr Sikora January 05, 2010 02:44AM

Re: need help calling PHP as a fallback

davvv January 05, 2010 03:15AM

Re: need help calling PHP as a fallback

edogawaconan January 05, 2010 04:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 297
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready