How-to

nginx on Ubuntu 20.04, and Moving Sites to a Newer Release

apt install nginx still works on Ubuntu 20.04, but standard support for that release ended in 2025. The practical job today is keeping such a box safe until its sites move.

Can I still install nginx on Ubuntu 20.04?

Yes. The archive package is nginx 1.18 and installs as usual:

sudo apt-get update
sudo apt-get install --no-install-recommends nginx-core
nginx -v

nginx-core is the lean build without extra third-party modules; the plain nginx meta-package pulls the same core. The service starts and enables itself, the default page answers on port 80, and site files live under /etc/nginx/sites-available. What changed is the support status: Ubuntu 20.04 reached the end of standard security maintenance in 2025. New fixes for its packages now come only through Ubuntu Pro (Expanded Security Maintenance). Without it, nginx and OpenSSL on that box stay at their last free versions.

Which Ubuntu releases do new machines get?

Our images are Ubuntu 24.04 and 22.04, both in standard support, alongside Debian, Enterprise Linux, Proxmox VE and FreeBSD. A machine you order today will not run 20.04. This page is for the box you already have somewhere else, or for a site that was built against 20.04 and needs a new home.

ReleaseArchive nginxStandard supportOn our images
Ubuntu 20.041.18ended in 2025No
Ubuntu 22.041.18until 2027Yes
Ubuntu 24.041.24until 2029Yes

How do I keep a 20.04 nginx box safe meanwhile?

  • Attach Ubuntu Pro if you qualify; sudo pro attach with a token turns on ESM updates, then sudo apt-get upgrade as usual.
  • Strip what you do not need: server_tokens off; in the http block, remove unused sites from sites-enabled, and restrict admin paths by address.
  • Put a packet filter in front with only 22, 80 and 443 open, and add Set up fail2ban for logins.
  • Plan the move. A frozen release is a short-term state, not a hosting strategy.

Should I upgrade in place or move to a new machine?

do-release-upgrade can take 20.04 to 22.04 and then to 24.04, but two jumps on a live server mean PHP, Python and OpenSSL versions all change underneath your apps at once, with a reboot in between and no easy undo. A fresh machine with a clean 24.04 install lets you copy the sites over, test them on the new box while the old one still serves, and switch DNS when everything passes. For a budget operation it is also cheaper in hours. A month on an S1 or E2 running side by side costs less than a lost weekend of debugging a broken upgrade.

How do I move nginx sites to a new 24.04 machine?

On the new box install nginx and the same runtimes, then pull config and content across with rsync over SSH:

sudo apt install -y nginx
sudo rsync -aHAX --numeric-ids -e 'ssh -p 22' olduser@old.example.com:/etc/nginx/sites-available/ /root/old-nginx-sites/
sudo rsync -aH --info=progress2 -e ssh olduser@old.example.com:/var/www/ /var/www/

Review each site file before enabling it; do not copy nginx.conf wholesale, because 1.24 has new defaults worth keeping. Things that commonly need edits when going from 1.18 to 1.24:

  • PHP-FPM socket paths change with the PHP version, for example php7.4-fpm.sock becomes php8.3-fpm.sock.
  • ssl_protocols lines that still list TLSv1 or TLSv1.1 should drop them; OpenSSL 3 disables them by default anyway.
  • Certificates: either copy /etc/letsencrypt as a whole, or issue fresh ones on the new box after DNS moves.
  • Any listen 443 ssl http2; lines still work on 1.24; on mainline 1.25 and newer switch to http2 on;.

How do I test before switching DNS?

Point your own computer at the new machine without touching public DNS. Add a line to your local hosts file, or use curl's resolve option:

curl -sv --resolve www.example.com:443:203.0.113.25 https://www.example.com/ -o /dev/null

If the certificate is not on the new box yet, test over port 80 the same way. Check logins, uploads and anything that writes to disk. Lower the DNS TTL to 300 seconds a day ahead, sync files and databases one final time, then change the A record. Keep the old server read only for a few days in case something was missed.

What about databases on the same box?

Dump and restore rather than copying data files between versions: mysqldump --single-transaction for MySQL or MariaDB, pg_dump -Fc for PostgreSQL. For larger sites, set up replication from old to new and cut over with a few seconds of read-only time. MySQL servers lists machines people use for that role.

Once moved, follow Install nginx on Ubuntu 22.04 for layout and tuning tips that also apply to 24.04, and Let's Encrypt with nginx for certificates.

Affordable Machines for a 24.04 Migration

ServerProcessorCores / threadsMemoryStorageNetworkPer monthSmallest order
E2Intel Xeon E3-1270 v34 / 832 GB DDR31x 480 GB SSD2x 1 Gbps$38.32$114.96 (3 months)
S1Intel Xeon E-2276G6 / 1264 GB DDR41x 1 TB NVMe2x 10 Gbps$53.32$53.32 (1 month)
S2Intel Xeon E-2356G6 / 1264 GB DDR41x 1 TB NVMe2x 10 Gbps$58.39$58.39 (1 month)
S5Intel Xeon E-2276G6 / 12128 GB DDR42x 1 TB NVMe2x 10 Gbps$88.72$88.72 (1 month)

Keep Reading

Install nginx on Ubuntu 22.04

Install nginx on Ubuntu 22.04 from the archive or the upstream repository, add a server block and open the firewall in a few minutes.

Open

Rsync over SSH

Copy and mirror folders between machines with rsync over SSH: trailing slashes, dry runs, custom ports, sudo on the far side and bandwidth caps.

Open

Ubuntu

Ubuntu 24.04 or 22.04 LTS on a whole machine: the default pick when you want the biggest pool of packages and how-tos.

Open

MySQL servers

Give InnoDB a buffer pool that holds your working set, NVMe for the redo log and no hypervisor between query and disk.

Open

FAQ

Quick Answers

Standard security maintenance ended in 2025. Updates continue only through Ubuntu Pro Expanded Security Maintenance.

No. The Ubuntu images are 24.04 and 22.04, which are both in standard support.

Version 1.24 from the archive, with Ubuntu security updates until 2029.

Copy site files, not the main nginx.conf. The newer package has better defaults, and old paths such as PHP sockets usually change.

Use curl --resolve or a local hosts file entry to send your own requests to the new IP while the public still uses the old one.