N
N
Nils222013-07-12 10:08:40
Nginx
Nils22, 2013-07-12 10:08:40

nginx config for cgi handling

Good afternoon, can someone tell me what should be written in the nginx configuration so that ngix can process executable files?

I tried to find information on the network, I could not, everything I found concerned fastcgi, but this is not what I need.

What I want:
- write a program in C or C ++, compile it into an executable file
- call domain.com/cgi/myprogram.cgi

I already did this on Apache and everything was fine and worked, now I want to replace Apache with nginx)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
X
xbreaker, 2013-07-12
@xbreaker

Nginx is a web server and to work with CGI it needs an application server, for example, uWSGI or FastCGI, which you just specified, you can even leave Apache, and in the site configuration you write something like:

location /cgi-bin {
    proxy_pass http://127.0.0.1:8080
}

M
marazmiki, 2013-07-12
@marazmiki

You can emulate cgi using fastcgi . From the developer's point of view, there is no difference: the same script, not sharpened for fcgi, the same process launch for each request. But it's still fastcgi.

A
Antalhen, 2013-07-12
@Antalhen

There is also SimpleCGI .
As for fastcgi, maybe you didn’t manage to set it up properly?
As for fast-cgi
Here's another http://chriswu.me/blog/writing-hello-world-in-fcgi-with-c-plus-plus/
And there is no other way...

A
AxisPod, 2013-07-12
@AxisPod

cgi is too slow, fastcgi is fastened quite easily using the fcg++ library. Or give up on fcgi in general, take libevent or boost::asio for example and make your own server. These libraries have their own ready-made simple examples. Then just configure upstream and that's it. You can also make a module for nginx, but this is already an unportable solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question