Nginx + v8cgi

Has anyone use nginx and v8cgi together?
maybe someone can help me how to configure it ^^
i am extremely newbie in nginx, and i think to leave php and move to
server side javascript v8cgi that is faster than php
maybe if someone kindly give their fine tutorial, it sould be put on
the nginx wiki ^^

Maybe someone need it, this is my script to compile v8 in ubuntu 9.04
x64

svn checkout http://v8.googlecode.com/svn/trunk/ .
scons mode=release library=shared snapshot=on arch=x64

originally linked to libv8.so.0

sudo rm /usr/lib/libv8.so
sudo ln -s /home/admin/Repository/v8/libv8.so /usr/lib/libv8.so

Maybe someone need it too, this is my script to compile v8cgi in ubuntu
9.04 x64

more dependencies to aptitude:

http://code.google.com/p/v8cgi/wiki/Compiling

#wget --continue
http://launchpadlibrarian.net/26305244/libicu40_4.0.1-2_amd64.deb
#wget --continue
http://launchpadlibrarian.net/26305246/libicu-dev_4.0.1-2_amd64.deb
#wget --continue
http://launchpadlibrarian.net/30735190/libxerces-c3.0_3.0.1-2_amd64.deb
#wget --continue
http://launchpadlibrarian.net/30735191/libxerces-c-dev_3.0.1-2_amd64.deb
#sudo dpkg -i libicu40_4.0.1-2_amd64.deb
#sudo dpkg -i libicu-dev_4.0.1-2_amd64.deb
#sudo dpkg -i libxerces-c3.0_3.0.1-2_amd64.deb
#sudo dpkg -i libxerces-c-dev_3.0.1-2_amd64.deb
svn checkout http://v8cgi.googlecode.com/svn/trunk/ .
scons reuse_context=1 mysql=1 pgsql=1 sqlite=1 fcgi=1 gd=1 dom=1
module=1 arch=x64
ifile=/etc/v8cgi.conf
sudo cp v8cgi.conf.posix $ifile
param=‘s//usr/lib/v8cgi//home/admin/Repository/v8cgi/lib/g’
sudo sed -i “$param” $ifile
/usr/lib/v8cgi
ifile=‘/home/admin/Repository/v8cgi/v8cgi’
ofile=‘/usr/lib/v8cgi’
sudo rm $ofile
sudo ln -s $ifile $ofile
ofile=‘/usr/local/bin/v8cgi’
sudo rm $ofile
sudo ln -s $ifile $ofile
ifile=‘/etc/apache2/mods-available/v8cgi.load’
sudo touch $ifile
sudo chmod 777 $ifile
sudo echo ‘LoadModule v8cgi_module
/home/admin/Repository/v8cgi/mod_v8cgi.so’ > $ifile
sudo chmod 644 $ifile
ls -al $ifile
ifile=‘/etc/apache2/mods-available/v8cgi.conf’
sudo touch $ifile
sudo chmod 777 $ifile
sudo echo ‘AddHandler v8cgi-script .sjs .ssjs .jst’ > $ifile
sudo chmod 644 $ifile
ls -al $ifile
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/apache2 stop

Regards,
Kis
GB

Has anyone use nginx and v8cgi together?
maybe someone can help me how to configure it ^^

Well, nginx doesn’t support CGI [1] or Apache modules [2] which appear
to be
what you’re building there, so you might want to consider contributing
FCGI
support to the v8cgi project (or see if it is already being worked on by
someone else).

  • Jeff

[1] You could use a FastCGI wrapper though.
[2] Nor should it.

On Wed, Oct 07, 2009 at 02:27:01PM +0700, Kiswono P. wrote:

scons mode=release library=shared snapshot=on arch=x64
http://launchpadlibrarian.net/26305246/libicu-dev_4.0.1-2_amd64.deb
module=1 arch=x64
You probably may use it as FastCGI server, however, I do not know how.

ok, i guess i give up with v8cgi T_T theres no reply at all from the
users of v8cgi about it’s fastcgi support T_T (i’ve browse the source
code of v8cgi fastcgi support, and it seems correct, and use it with
conjunction with spawn-fcgi program)
http://groups.google.com/group/v8cgi/browse_thread/thread/fbd7645d2cbe199a

is there anyone that use nginx with another “fast” server side
javascript engine (other than v8cgi)?
or, if “fast” not available, then i lower my standard to “usable” ^^
thanks guys… ^^

Regards,
GB

On 13.10.2009, at 17:20, Kiswono P. [email protected] wrote:

ok, i guess i give up with v8cgi T_T theres no reply at all from the
users of v8cgi about it’s fastcgi support T_T (i’ve browse the source
code of v8cgi fastcgi support, and it seems correct, and use it with
conjunction with spawn-fcgi program)
http://groups.google.com/group/v8cgi/browse_thread/thread/fbd7645d2cbe199a

is there anyone that use nginx with another “fast” server side
javascript engine (other than v8cgi)?
or, if “fast” not available, then i lower my standard to “usable” ^^
thanks guys… ^^
You could try one of the following:

  1. node.js: event based environment built up on the libev and the v8
    with alive community :wink:
  2. Jaxer: headless Gecko run as server
  3. nginx_http_js_module or nginx_http_js_module or ngxv8: all are the
    proof of concept quality
  4. use v8cgi via apache :wink:

Regards,
GB

Best regards,
Peter L.

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 ^^

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

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( ‘’ );
response.write( HTML.dump(global) ); // scary but needed for debug
response.write( ‘’ );

======
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 P. [email protected]
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 ^^

Kiswono P. wrote:

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

I always had massive problems with spawn-fcgi; random memory leaks,
dropped connections, etc. You might want to use something like
Supervisord1 to manage your JS script instances.

Phillip B Oldham
ActivityHQ
[email protected] mailto:[email protected]


Policies

This e-mail and its attachments are intended for the above named
recipient(s) only and may be confidential. If they have come to you in
error, please reply to this e-mail and highlight the error. No action
should be taken regarding content, nor must you copy or show them to
anyone.

This e-mail has been created in the knowledge that Internet e-mail is
not a 100% secure communications medium, and we have taken steps to
ensure that this e-mail and attachments are free from any virus. We must
advise that in keeping with good computing practice the recipient should
ensure they are completely virus free, and that you understand and
observe the lack of security when e-mailing us.