How to use C as a scripting language?

James Fidell james at
Sat Dec 3 10:30:14 UTC 2011

On 03/12/11 07:38, etrader wrote:
> I am using php in nginx. I wonder how can I modify nginx configuration
> to work with C too. Considered a simple c file (hello.c and compiled as
> a.out) with printf of
>   printf("Content-type: text/html\r\nStatus: 200 OK\r\n\r\n");
>   printf("Hello World");
> how can I display Hello World by browsing the compiled version on
> localhost/a.out

The best solution probably depends on what you're trying to achieve and
your particular circumstances.  As well as the solutions already
suggested, one method I've used is to build the C program against
libevent, effectively using libevent to build a mini webserver that is
running all the time.  nginx can then use that as an upstream proxy.


More information about the nginx mailing list