Debian Buster (10)

Install latest Nginx version from source – Debian 10 (Buster)

This article shows you how to install Nginx version 1.23 (at the time of writing this article) on a RaspberryPi running Debian 10 (Buster). This scenario might arise as Debian 10 comes pre-packaged with version 1.14 and if you want to upgrade, the only way around is, to compile from source to get to the latest version.

First start off by installing the required utils and libraries that will be required for compiling from source

# sudo apt-get install curl build-essential make gcc libpcre3 libpcre3-dev libpcre++-dev zlib1g-dev libbz2-dev libxslt1-dev libxml2-dev libgeoip-dev libgoogle-perftools-dev libgd-dev libperl-dev libssl-dev libcurl4-openssl-dev

Now download the latest Nginx package using wget

# sudo wget

Now untar the file and cd into the directory

# sudo tar xvf nginx-1.23.0.tar.gz && cd nginx-1.23.0/

Now configure the options for Nginx. You can include or exclude options based on your prefrences.

./configure \
--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/                              \
--lock-path=/var/run/nginx.lock                            \
--http-client-body-temp-path=/var/cache/nginx/client_temp  \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp         \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp     \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp         \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp           \
--user=nginx                                               \
--group=nginx                                              \
--with-http_ssl_module                                     \
--with-http_realip_module                                  \
--with-http_addition_module                                \
--with-http_sub_module                                     \
--with-http_dav_module                                     \
--with-http_flv_module                                     \
--with-http_mp4_module                                     \
--with-http_gunzip_module                                  \
--with-http_gzip_static_module                             \
--with-http_random_index_module                            \
--with-http_secure_link_module                             \
--with-http_stub_status_module                             \
--with-http_auth_request_module                            \
--with-mail                                                \
--with-mail_ssl_module                                     \
--with-file-aio                                            \
--with-http_v2_module                                      \
--with-threads                                             \
--with-stream                                              \
--with-stream_ssl_module                                   \

Copy the above code in its entirety and paste it in the terminal, then hit Enter to start the configuration.

Now start the compilation by using Make

# sudo make

Now install it on the RaspberryPi

# sudo make install

Now create the required User and Group

# sudo useradd -r nginx

Now create a tmp file for Nginx process

# sudo mkdir /var/cache/nginx && sudo touch /var/cache/nginx/client_temp

Now create a systemd service for Nginx. Create a file for it

# sudo vi /lib/systemd/system/nginx.service

Now copy the following code into it.

Description=The NGINX HTTP and reverse proxy server

ExecStartPre=/usr/sbin/nginx -t
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID


Now kill the Nginx process if any, and then restart the service and enable it at runtime

sudo pkill nginx
sudo systemctl start nginx
sudo systemctl status nginx
sudo systemctl enable nginx

Now verify the installed version and it should show up as nginx 1.23

# nginx -v


# nginx -v
nginx version: nginx/1.23.0

That’s about it and the latest Nginx should be up and running now. If you encounter any issues, please get in touch via Contact Us and we will try our best to resolve.

Leave a Reply

Your email address will not be published.