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.
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
You can download the already compiled version here. Once the package installed, everything will be in /usr/local/nginx (binaries and configuration)
The steps are as follows :
- Install packages needed for compiling
apt-get install -y make gcc libpcre3 libpcre3-dev zlib1g-dev libbz2-dev libssl-dev
- Download version 1.6.2 of Nginx
- Unpack the archive
tar zxvf nginx-1.6.2.tar.gz
- Start the configuration
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
Compilation time is fast enough (less than 10 minutes) even without having overclocked the Raspberry. Then the installation with
Here you are with the latest version of Nginx !