Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Philesight on Ubuntu

Install dependencies

sudo apt-get install libdb4.2-ruby1.8 libcairo-ruby1.8

Install Philesight

git clone
cd philesight
sudo ./philesight --db philesight.db --index /


Nginx doesn't run CGI on its own, we need a wrapper:

sudo apt-get install fcgiwrap

Run fcgiwrap on port 8888

fcgiwrap -s tcp:

Add Nginx site /etc/nginx/sites-available/philesight

server {

    root        /home/phunehehe/philesight;

    location ~ /.*\.cgi$ {
        gzip off; #gzip makes scripts feel slower since they have to complete before getting gzipped
        fastcgi_index index.cgi;
        fastcgi_param SCRIPT_FILENAME   /home/phunehehe/philesight$fastcgi_script_name;
        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 GATEWAY_INTERFACE CGI/1.1;
        fastcgi_param SERVER_SOFTWARE   nginx;
        fastcgi_param SCRIPT_NAME       $fastcgi_script_name;
        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 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       $server_name;

Enable the site

sudo nxensite philesight
sudo /etc/init.d/nginx restart


Add site /etc/apache2/sites-available/philesight:

<VirtualHost *:80>

    DocumentRoot /home/phunehehe/philesight

    <Directory "/home/phunehehe/philesight">
        Options +ExecCGI
        AddHandler cgi-script .cgi


Enable it

sudo a2ensite philesight
sudo /etc/init.d/apache2 reload


Enjoy the graph at


This comment has been minimized.

Copy link
Owner Author

phunehehe commented Jun 18, 2013

Trying the following for ruby 1.9:

sudo gem install cairo
sudo apt-get install libdb-dev
sudo gem install bdb

But it's not working:

/home/phunehehe/philesight/philesight.rb:57:in `rescue in db_open': uninitialized constant Philesight::BDB (NameError)
        from /home/phunehehe/philesight/philesight.rb:54:in `db_open'
        from ./philesight:106:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.