# Nginx and FastCGI C/C++

**URL:** <https://www.ruby-forum.com/t/nginx-and-fastcgi-c-c/189699>\
**Category:** NGINX\
**Created:** [June 5, 2010, 3:31pm UTC](https://www.ruby-forum.com/t/nginx-and-fastcgi-c-c/189699 "2010-06-05T15:31:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kleinchris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b2d939/32.png) [@kleinchris](https://www.ruby-forum.com/u/kleinchris)\
**Post date:** [June 5, 2010, 3:31pm UTC](https://www.ruby-forum.com/t/nginx-and-fastcgi-c-c/189699/1 "2010-06-05T15:31:37Z")

</div>

Hello is it possible, that nginx can open FastCGI Application’s like the  
Apache2 mod\_fastcgi and open applications like:

```auto
#include <fcgi_stdio.h>

int main(void)
{
   unsigned int counter = 1;
   while(FCGI_Accept() >= 0)
   {
      printf("Content-type: text/html\r\n\r\n");
      printf("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 
Transitional//EN\"\r\n");
      printf(" 
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n\r\n");
      printf("<html>\r\n");
      printf(" <head>\r\n");
      printf(" <title>FastCGI ist schnell!</title\r\n");
      printf(" </head>\r\n");
      printf(" <body>\r\n");
      printf(" <h1>Das erste FastCGI</h1>\n\r");
      printf(" <p>Das FastCGI wurde bisher %d mal 
aufgerufen</p>\r\n",
            counter++);
      printf(" </body>\r\n");
      printf("</html>\r\n");
   }
   return 0;
}
```

The file ending should be index.fcgi, and i don’t want a fastcgi\_pass  
directive… Is this possible?

Posted at Nginx Forum:

> **[nginx and FastCGI C/C++](https://forum.nginx.org/read.php?2,94807,94807#msg-94807)**
>
> Hello is it possible, that nginx can open FastCGI Application's like the Apache2 mod\_fastcgi and open applications like: \[code\] #include \<fcgi\_stdio.h\> int main(void) { unsigned int counter = 1; while(FCGI\_Accept() \>= 0) {

---

<div class="post-metadata">

**Author:** ![kleinchris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b2d939/32.png) [@kleinchris](https://www.ruby-forum.com/u/kleinchris)\
**Post date:** [June 5, 2010, 10:49pm UTC](https://www.ruby-forum.com/t/nginx-and-fastcgi-c-c/189699/2 "2010-06-05T22:49:24Z")

</div>

Why don’t you want a fastcgi\_pass directive?

Otherwise it’s easy especially with the use of supervisord from my own  
experience. See the thread

> **[configuratioin fastcgi C/C++ program](https://forum.nginx.org/read.php?2,93268)**
>
> hello I have a fastcgi program like this \[code\] 1 #include "/usr/local/include/fcgi\_stdio.h" 2 #include \<stdlib.h\> 3 int count; 4 void initialize(void) 5 { 6 count=0; 7

for more details

Posted at Nginx Forum:

> **[Re: nginx and FastCGI C/C++](https://forum.nginx.org/read.php?2,94807,94902#msg-94902)**
>
> Hello is it possible, that nginx can open FastCGI Application's like the Apache2 mod\_fastcgi and open applications like: \[code\] #include \<fcgi\_stdio.h\> int main(void) { unsigned int counter = 1; while(FCGI\_Accept() \>= 0) {

---

<div class="post-metadata">

**Author:** ![kleinchris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b2d939/32.png) [@kleinchris](https://www.ruby-forum.com/u/kleinchris)\
**Post date:** [June 6, 2010, 12:54am UTC](https://www.ruby-forum.com/t/nginx-and-fastcgi-c-c/189699/3 "2010-06-06T00:54:41Z")

</div>

Why creating a socket and spawn it by myself with spawn-fcgi or another  
fcgi wrapper?! It’s easier on Apache2 where my .fcgi files wrapped  
automatically.

Posted at Nginx Forum:

> **[Re: nginx and FastCGI C/C++](https://forum.nginx.org/read.php?2,94807,94923#msg-94923)**
>
> Hello is it possible, that nginx can open FastCGI Application's like the Apache2 mod\_fastcgi and open applications like: \[code\] #include \<fcgi\_stdio.h\> int main(void) { unsigned int counter = 1; while(FCGI\_Accept() \>= 0) {
