I am using nginx and running fcgi protocol using golang's fcgi module. How can I respawn my fcgi process automatically by nginx ?

My nginx.conf looks like

server {
    listen 80;
    server_name 127.0.0.1;
    root /home/jdk2588/testdir;
    index index.html;   
    location / {
        access_log  /home/jdk2588/KARMA/nginx/access.log;
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-Ip $remote_addr;
        proxy_set_header X-Scheme $scheme;
    }
    location ~ /goapp {
        include         fastcgi.conf;
        fastcgi_pass    127.0.0.1:9001;
    }
}
有帮助吗?

解决方案

From the docs

Unlike Apache or Lighttpd, Nginx does not automatically spawn FCGI processes. You must start them separately.

So you'll need to use an OS facility to do that.

My favourite is supervisord but there are lots of other ways of doing it.

There isn't a go way of restarting a process when it dies as far as I know

其他提示

i recommend to use uwsgi for managing fcgi processes. it is capable of spawning a amount of worker-processes ready for input and restart them when they die. highly configurable and easy to install and use.

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

i have the options worker-exec, spooler, processes, protocol, enable-threads and master set.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top