v8cgi on Ubuntu (Natty)

NOTE: replace ~/src with path to where you checkout and build v8 and v8cgi!

NOTE: If you don't like to use vi to edit files, use gedit instead.

prerequisites

$ sudo apt-get install apache2 subversion python scons
$ sudo apt-get install libmysqlclient-dev libgd2-xpm-dev apache2-threaded-dev libmemcached-dev

build

(replace ~/src with path to where you compile these):
$ mkdir ~/src
$ cd ~/src

$ svn checkout http://v8.googlecode.com/svn/trunk/ v8
$ cd v8

$ scons arch=ia32 library=shared


Possible arch values are (arm, ia32, x64, mips)

$ sudo cp libv8.so /usr/lib/libv8.so

$ cd ..
$ svn checkout http://v8cgi.googlecode.com/svn/trunk/ v8cgi
$ cd v8cgi
$ scons module=1 gd=1 mysql=1
$ sudo cp v8cgi.conf.posix /etc/v8cgi.conf

configure /etc/v8cgi.conf

$ sudo vi /etc/v8cgi.conf
require.paths = ['~/src/v8cgi/lib'];


remember to replace ~/src with where you built v8 and v8cgi

configure apache module:

$ sudo vi /etc/apache2/mods-available/v8cgi.load


The only line in the file should be:

LoadModule v8cgi_module ~/src/v8cgi/mod_v8cgi.so




$ sudo vi /etc/apache2/mods-available/v8cgi.conf


The only line in the file should be:

AddHandler v8cgi-script .sjs .jst

enable the mod:

$ sudo a2enmod v8cgi

create/edit virtual host file

$ sudo vi /etc/apache2/sites-available/v8cgi


This configuration should work (remember to replace ~/src with where you built v8 and v8cgi)

<VirtualHost *:80>
        ServerName v8cgi
        ServerAdmin webmaster@localhost
        DocumentRoot ~/src/v8cgi/example/htdocs

        <Directory ~src/v8cgi/example/htdocs>
                Options Indexes All Multiviews
                AllowOverride All
                Order allow,deny
                allow from all
                DirectoryIndex index.sjs
        </Directory>

        ErrorLog /var/log/apache2/v8cgi_error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/v8cgi_access.log combined
        ServerSignature On

</VirtualHost>

enable the site:

$ sudo a2ensite v8cgi

configure v8cgi hostname

$ sudo vi /etc/hosts

the first line in mine looks like this:
127.0.0.1       localhost v8cgi

restart apache:

$ sudo /etc/init.d/apache2 restart

Check it out: point browser at http://v8cgi/

Last edited May 4, 2011 at 3:27 PM by leooo, version 3

Comments

No comments yet.