Compile Nginx 1.6.2 for Raspberry Pi

Nginx remains for me one of the best web servers for Raspberry Pi. A simple configuration, it is powerful, which is perfect for a small configuration. Here is how to get the latest version easily.

Nginx-logo

Yes but why do we want the latest version ?

Already to take advantage of the latest security patches. Especially if your Raspberry is exposed on the Internet ! Some of these faults are present since version 0.8 !

About improvements, There are many, some technicals, but the most important are (to summarize those are in a previous article) :

  • SPDY support (speedy) 3.1, Protocol initiated by Google and supported by several browsers (IE 11+, Chrome, Firefox 23+). The Protocol allows to accelerate loads of a page via the management of priorities in the elements that make up a page
  • Authentication via an external server
  • Revalidation of the cache through the "If-modified-Since" header. Allows to serve the responses based on the cache managed by Nginx.
  • Several improvements on the SSL layer
  • Improvements on the MP4 streaming

The steps are as follows :

  1. Install packages needed for compiling
    apt-get install -y make gcc libpcre3 libpcre3-dev zlib1g-dev libbz2-dev libssl-dev
  2. Download version 1.6.2 of Nginx
    wget http://nginx.org/download/nginx-1.6.2.tar.gz
  3. Unpack the archive
    tar zxvf nginx-1.6.2.tar.gz
    cd nginx-1.6.2
  4. Start the configuration
    ./configure

You almost ready to launch the compilation. Why almost ? Because it is now that you must decide which modules you want to enjoy. It is one of the disadvantages of Nginx, It is that modules do not dynamically load. Some are loaded by default (see the list here), others are to choose at the beginning (see the list here)

Here is an example of modules that you can add :

  • SSL support
  • SPDY support
  • Automatic compression of static files
  • Decompression on the fly of compressed responses

The command will then be as follows :

./configure --with-http_gzip_static_module --with-http_gunzip_module --with-http_spdy_module --with-http_ssl_module

To go further, You can either write your own module (express your ultra geek dark side !), either add another already completed module. You will find a list on this page. Attention quand même à pas installer tout et n’importe quoi 😉 Une fois l’archive récupérée et décompressée, You can add it with the option –add-module=/path/to/module/source to the command configure (You can put as much as you want)

You can now start the compilation with the command

make

Compilation time is fast enough (less than 10 minutes) even without having overclocked the Raspberry. Then the installation with

make install

Here you are with the latest version of Nginx !

Nginx 1.6.2 on Raspberry Pi - powerpcspe

You may also like...

  • Libor Gabaj

    Please help me with Nginx module RRDGraph. I have done everything according to your guide, installed rrdtool 1.4.7, and downloaded the module mod_rrd_graph-0.2.0. But at “./config –add-module” I got the error “checking for RRDtool … not found;./configure: error: ngx_rrd_graph requires RRDtool 1.3 or later.”. Neither rebooting nor adding path to rrdtool in the module’s config variable “ngx_feature_path” has helped. What shall I do or check in order to compile the module please?

    • Hello
      It sounds as if your installation was not made in a path expected by the configuration tool. Can you please look in the source of the module and check where the module needs RRDTool ? Then you compare with the path where RRDTool is installed.

  • Perso, I use Monkey as web server. More reactive than Nginx on my Pi Raspberry. But I don't use or Bdd, or PHP (static site). http://www.monkey-project.com/ for those that are interested.