THE script that manages NGinx/PHP developement server


A lightweight launcher for a PHP/Nginx development server

To give the possibility to a user without admin privileges to easily launch a PHP development server.

  • PHP in CGI mode: php-cgi -v must returns php-fcgi in output
  • Nginx server

On Ubuntu systems:

sudo apt-get install nginx-full php5-cgi

On archlinux:

pacman nginx php-cgi

To install sng locally :

npm install sng

To install globally in system use:

npm install sng -g
  -n, --nginx-base        Default binding NGinx wil be listening on            [default: ""]
  -p, --php-bind          Default binding address for php-cgi                  [default: ""]
  -b, --behavior          Changes behavior. Avialable are: "standard", "zend"  [default: "standard"]
  -x, --extra-directives  Extra directives file for the NGinx server 

You can directly store the configuration file in the root folder of the server. sng will look for .sng.conf.tpl files in the root folder. A very basic configuration file would look like that :

location / {
    if ($uri ~ "\.php") {
        fastcgi_pass {{ php_bind }};
    access_log  {{ tmpdir }}/access.log mine;

Warning : The {{ php_bind }} represents the ip and port on which php-cgi is running, for exemple is the default binding.