Skip to main content
nginx upgrade

Upgrade nginx from 1.18 to 1.27 on Ubuntu 18.04 LTS

this will leave your existing nginx 1.18.0 intact just in case, but will replace the running version of nginx with 1.27.0

cd /usr/src/
wget https://nginx.org/download/nginx-1.27.0.tar.gz
tar xvf nginx-1.27.0.tar.gz
cd nginx-1.27.0
./configure --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-Iwde_Y/nginx-1.18.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_sub_module
make && make install
systemctl stop nginx
mv /usr/sbin/nginx /usr/sbin/nginxO; ln -s /usr/share/nginx/sbin/nginx /usr/sbin/nginx

disable some non used old modules
rm /etc/nginx/modules-enabled/50-mod-http-image-filter.conf
rm /etc/nginx/modules-enabled/50-mod-stream.conf
rm /etc/nginx/modules-enabled/70-mod-stream-geoip.conf
rm /etc/nginx/modules-enabled/50-mod-http-geoip.conf
rm /etc/nginx/modules-enabled/50-mod-http-xslt-filter.conf
rm /etc/nginx/modules-enabled/50-mod-mail.conf

nginx -t (and make sure all is ok)
then systemctl start nginx

Tags
We are the UK's leading Linux support specialists. We do maintenance agreements, hosting, installations and security for all systems including Microsoft.

Contact info

Please contact us to discuss your requirements, we love a good problem!