Welcome! Log In Create A New Profile

Advanced

Nginx-FastCGI-C++

December 09, 2010 03:24AM
I have a Fastcgi C++ program as follow:

[code]
1 #include "fcgi_stdio.h"
2 #include <stdlib.h>
3
4 int main(void)
5 {
6 int count = 0;
7 while(FCGI_Accept() >= 0)
8 printf("Content-type: text/html\r\n"
9 "\r\n"
10 "<h1>Tiny3</h1>"
11 "<h1>FastCGI World!</h1>"
12 "Request number %d running on host <i>%s</i>\n",
13 ++count, getenv("SERVER_NAME"));
14 return 1;
15 }
[/code]


then i have modified the Nginx conf file
[code]
30 upstream fastcgiends{
31 server 127.0.0.1:9110 weight=1 max_fails=2 fail_timeout=30s;
32 server 127.0.0.1:9111 weight=1 max_fails=2 fail_timeout=30s;
33 }
[/code]


[code]
location =/3.cgi {
#fastcgi_pass 127.0.0.1:9553;
fastcgi_pass fastcgiends;
}
[/code]



start the spawn-fcgi command :
[code]
spawn-fcgi -a 127.0.0.1 -p 9110 -f ./tiny3 -P ./pid/fastcgi_9110.pid
spawn-fcgi -a 127.0.0.1 -p 9111 -f ./tiny3 -P ./pid/fastcgi_9111.pid
[/code]


but I found i can't query it from the web [code]
http://122.36.180.89:9095/3.cgi
[/code]


and does anyone konw sth about this problem ?
Subject Author Posted

Nginx-FastCGI-C++

kevinew December 09, 2010 03:24AM

Re: Nginx-FastCGI-C++

kevinew December 09, 2010 05:22AM

Re: Nginx-FastCGI-C++

TECK December 09, 2010 05:43PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 222
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