Skip to content

Instantly share code, notes, and snippets.

@dolt131943
Last active February 22, 2018 02:36
Show Gist options
  • Save dolt131943/64b05170c4ae4622a5ddb3b15f3db0ea to your computer and use it in GitHub Desktop.
Save dolt131943/64b05170c4ae4622a5ddb3b15f3db0ea to your computer and use it in GitHub Desktop.
nginx invoke bash

download and install fcgiwrap

https://centos.pkgs.org/7/ghettoforge-x86_64/fcgiwrap-1.1.0-1.gf.el7.x86_64.rpm.html

wget http://mirror.ghettoforge.org/distributions/gf/el/7/gf/x86_64/gf-release-7-10.gf.el7.noarch.rpm

rpm -Uvh gf-release-*.rpm

yum --enablerepo=gf install fcgiwrap

enable nginx to invoke fcgiwrap

 location /testpath {
        gzip off;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;        
        fastcgi_param DOCUMENT_ROOT /home/helper;
        fastcgi_param SCRIPT_FILENAME /path/to/script_file;
        include /etc/nginx/fastcgi_params;
}

boot up fcgiwrap

fcgiwrap -f -s unix:/var/run/fcgiwrap.socket &

chmod a+rw /var/run/fcgiwrap.socketo

script must executable and can access

chmod a+rx /path/to/script_file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment