Compile latest nginx with latest OpenSSL on Raspbian strech
Nginx is a lightweight web server, which can also be used as a reverse proxy, load balancer or HTTP cache. With additional applications it can serve dynamic web pages like those written in PHP.
This tutorial is based on nginx 1.11.10 and openssl 1.1.0e.
First, create a directory:
cd ~
mkdir nginx cd nginx
Download nginx latest version using wget, then extract the archive:
wget https://nginx.org/download/nginx-1.11.10.tar.gz
tar xvf nginx-1.11.10.tar.gz
Download openssl latest version and extract the archive
wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
tar xvf openssl-1.1.0e.tar.gz
Switch to the newly created nginx source directory
cd nginx-1.11.10
Start the configuration:
./configure \ --http-client-body-temp-path=/var/run/nginx/body \ --http-fastcgi-temp-path=/var/run/nginx/fastcgi \ --http-proxy-temp-path=/var/run/nginx/proxy \ --http-scgi-temp-path=/var/run/nginx/scgi \ --http-uwsgi-temp-path=/var/run/nginx/uwsgi \ --user=www-data \ --group=www-data \ --prefix=/etc/nginx \ --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock \ --with-pcre-jit \ --with-http_v2_module \ --with-debug \ --with-http_stub_status_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_dav_module \ --with-http_gzip_static_module \ --with-http_sub_module \ --with-http_xslt_module \ --with-http_ssl_module \ --with-ld-opt=-lrt \ --with-openssl=../openssl-1.1.0e \ --with-http_v2_module \ --with-http_ssl_module
It takes about 1 minute. You can save the configure command parameters for later usage.
If everything looks good and no errors are reported, you can now start the compilation with the command (assuming your CPU has 4 cores)
make -j4
Depending on the system load, compiling takes about 10 minutes. If no errors are reported, test the resulting binary:
objs/nginx -V
The following output is expected:
nginx version: nginx/1.11.10 built by gcc 6.3.0 20170124 (Raspbian 6.3.0-5+rpi1) built with OpenSSL 1.1.0e 16 Feb 2017 TLS SNI support enabled configure arguments: --http-client-body-temp-path=/var/run/nginx/body --http-fastcgi-temp-path=/var/run/nginx/fastcgi --http-proxy-temp-path=/var/run/nginx/proxy --http-scgi-temp-path=/var/run/nginx/scgi --http-uwsgi-temp-path=/var/run/nginx/uwsgi --user=www-data --group=www-data --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --with-pcre-jit --with-http_v2_module --with-debug --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_gzip_static_module --with-http_sub_module --with-http_xslt_module --with-http_ssl_module --with-ld-opt=-lrt --with-openssl=../openssl-1.1.0e --with-http_v2_module --with-http_ssl_module
Finally, install
make install