nginx.conf

The important portions in nginx.conf look as follows:

    server {
            server_name  *suckless.org;

            autoindex    on; 

            charset utf-8;

            location ~* ^.+.(md|diff)$ {
                    root           /var/www/sites/$host;
            }

            location ~* ^/(pub|favicon.ico|robots.txt)$ {
                    root           /var/www/static/;
            }

            location / {
                    root           /var/www/sites/$host;
                    fastcgi_pass   unix:/var/run/fcgi/werc.sock;
                    include        fastcgi_params.werc;
            }

            location ~ /\.ht {
                    deny  all;
            }
    }

fastcgi_params.werc

    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;

    fastcgi_param  SCRIPT_NAME        /var/www/werc-dev/bin/werc.rc;
    fastcgi_param  REQUEST_URI        $request_uri;
    fastcgi_param  DOCUMENT_URI       $document_uri;
    fastcgi_param  DOCUMENT_ROOT      /; #$document_root;
    fastcgi_param  SERVER_PROTOCOL    $server_protocol;

    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

    fastcgi_param  REMOTE_ADDR        $remote_addr;
    fastcgi_param  REMOTE_PORT        $remote_port;
    fastcgi_param  SERVER_ADDR        $server_addr;
    fastcgi_param  SERVER_PORT        $server_port;
    fastcgi_param  SERVER_NAME        $host; # changed from $server_name
    fastcgi_param  REMOTE_USER        $remote_user;

/etc/init.d/spawn-fcgi-werc

    #!/bin/sh

    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    NAME=spawn-fcgi-wrap
    PID=/var/run/spawn-fcgi-wrap.pid
    DAEMON=/usr/local/bin/spawn-fcgi
    DAEMON_OPTS="-s /var/run/fcgi/werc.sock -u www-data -g www-data -P $PID -- /usr/local/bin/fcgiwrap" 

    test -x $DAEMON || exit 0

    set -e

    case "$1" in
    start)
            echo "Starting $NAME: "
            start-stop-daemon --start --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS
            echo "done."
            ;;
    stop)
            echo "Stopping $NAME: "
            start-stop-daemon --stop  --pidfile $PID --retry 5
            rm -f $PID
            echo "done."
            ;;
    restart)
            echo "Stopping $NAME: "
            start-stop-daemon --stop  --pidfile $PID --retry 5
            rm -f $PID
            echo "done..."
            sleep 1
            echo "Starting $NAME: "
            start-stop-daemon --start --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS
            echo "done."
            ;;
    *)
            echo "Usage: /etc/init.d/$NAME {start|stop|restart}" >&2
            exit 1
            ;;
    esac

    exit 0

To post a comment you need to login first.