Raspberry Pi – Install Nginx with support Python, Ruby and NodeJS

Most Web servers support PHP, some in most CGI. In this tutorial, We will see how to use Nginx with Python pages, Ruby or NodeJS.


The solution proposed to allow for pages in Ruby,Python and NodeJS is through the tool Phusion Passenger. He also moved to Apache for Nginx. It is to the latter that I chose to install it.

To install your Web server, Here's how :

  1. If you already have Nginx, the Passenger site recommends that you remove. Otherwise, You can install Nginx as explained in this article but in this case you will have two different binaries with different configurations.
    In the event that, Here is the command to uninstall Nginx :

    apt - get remove nginx nginx-full light nginx nginx-naxsi nginx-common
  2. Install Ruby
    apt - get install –y ruby
  3. Install RubyGems 1.8.25
    CD wget http://rubyforge.org/FRS/download.php/76729/RubyGems-1.8.25.tgz tar zxvf rubygems - 1.8.25.tgz cd rubygems - 1.8.25 ruby./setup.rb cd ..
    rm - rf rubygems - 1.8.25

    Execution of the command

    gem - version

    should return you 1.8.25

  4. Install Passenger
    gem install passenger
  5. Run the installation of Passenger and Nginx
  6. Follow the instructions and install the required packages if necessary. In this case then restart the command from the previous step.
    Passenger will may be complaining about the little memory (at home I have a 256 MB).
    I kept the default installation option in /opt/nginx to not complicate the configuration.
  7. At the end of the compilation, you meet your Nginx server in the directory /opt/nginx. In the sub directory conf, You can add a block server to manage your site. For example the application Tracks from this article, just add a block :
    server {
       listen 8000;
       passenger_enabled on;

    You must point to the public directory and the root (Here/var/www/tracks)

  8. Remember to look at the logs in/opt/nginx/log or those of the application if something goes wrong. It is a mine of information that in 99% the case will help you solve problems.

You now have a Web server capable of supporting other languages as HTML. Nothing then prevents adding PHP with php5-fpm or CGI with fastcgi support.

You may also like...