nginx + v8cgi

Kiswono Prayogo kiswono at gmail.com
Fri Oct 16 07:35:20 MSD 2009


ok i finally got it working T_T thanks God.. everybody say yay ^^

requirement: nginx or other web server with fcgi support
v8
v8cgi
spawn-fcgi
a js script that handle the requests, in this
example /home/kyz/Projects/site/index.esp
======
init script:

#!/bin/sh
ESP_SCRIPT='/home/kyz/Projects/site/index.esp'
V8C_SCRIPT="/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data
`which v8cgi` $ESP_SCRIPT"
KIL_SCRIPT="killall -v -9 `which v8cgi`"
RETVAL=0
case "$1" in
  start)
        $V8C_SCRIPT
        RETVAL=$?
        ;;
  stop)
        $KIL_SCRIPT
        RETVAL=$?
        ;;
  restart)
        $KIL_SCRIPT
        $V8C_SCRIPT
        RETVAL=$?
        ;;
  *)
        echo "Usage: v8fcgi {start|stop|restart}"
        exit 1
        ;;
  esac
ps aux | grep $ESP_SCRIPT | grep `which v8cgi`
exit $RETVAL

======
index.esp

#!/usr/local/bin/v8cgi
system.stdout(JSON.stringify(system.env));
response.write( '<html><body>' );
response.write( HTML.dump(global) ); // scary but needed for debug
response.write( '</body></html>' );

======
nginx sites-available/default, add:
        location ~ \.(sjs|ssjs|esp)$ {
                fastcgi_pass 127.0.0.1:9000;
                #fastcgi_index index.esp;    # i don't think this useful?
                #fastcgi_param SCRIPT_FILENAME
/usr/local/www/nginx$fastcgi_script_name; # what this one for?
                include fastcgi_params;

        }



On Thu, Oct 15, 2009 at 7:35 AM, Kiswono Prayogo <kiswono at gmail.com> wrote:
> ngxv8 not good (yet), i've tried it, and remove it immediately.. ^^
> yes, currently i'm trying nginx_http_js_module.. thanks for your
suggestions ^^
>
>> 3.
>> nginx_http_js_module or
>> nginx_http_js_module or --> typo?
>> ngxv8 ?
>
> node.js --> not using nginx
> jaxer --> not using nginx
> ngxv8 --> not for production
> v8cgi --> not using nginx, i will try this again..
>
> Regards,
> GB
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20091016/9193795e/attachment.html>


More information about the nginx mailing list