C language FastCGI with Nginx

后端 未结 5 1318
挽巷
挽巷 2020-12-25 14:51

I am attempting to run a fastcgi app written in C language behind the Nginx web server. The web browser never finishes loading and the response never completes. I am not sur

5条回答
  •  孤城傲影
    2020-12-25 15:28

    After your application handles fastcgi-requests correctly, you need to take care of starting the application. nginx will never spawn fcgi processes itself, so you need a daemon taking care of that.

    I recommend using uwsgi for managing fcgi processes. It is capable of spawning worker-processes that are ready for input, and restarting them when they die. It is highly configurable and easy to install and use.

    http://uwsgi-docs.readthedocs.org/en/latest/

    Here is my config:

    [uwsgi]
    fastcgi-socket = /var/run/apc.sock
    protocol = fastcgi
    worker-exec = /home/app/src/apc.bin
    spooler = /home/app/spooler/
    processes = 15
    enable-threads = true
    master = true
    chdir = /home/app/
    chmod-socket = 777
    

    This integrates nicely as systemd service, but can also run without.

提交回复
热议问题