ServerHandbook live check: run log ------------------------------------------------------------------------------ Article https://serverhandbook.com/kb/nginx-http2-ubuntu-24-04 Check scripts/live/checks/nginx-http2-ubuntu-24-04.mjs (sha256 25fcc2110749cd4036f59042248e8ef933a44d402fc4c0b0f537b3ac92b4893b) Ran at 2026-11-13T19:08:55Z (347 s) Result PASS, all 25 claims held Tested on System Ubuntu 24.04.4 LTS Kernel 6.8.0-138-generic Package nginx 1.24.0-2ubuntu7.19 Package openssl 3.0.13-0ubuntu3.15 Package certbot 2.9.0-1 Package python3-certbot-nginx 2.9.0-1 Package curl 8.5.0-2ubuntu10.13 Setup A fresh Ubuntu 24.04 cloud server from a hosting provider (its stock image, a public IPv4 address), with a domain and its www name pointed at it, ufw on, Nginx serving one site with a Let’s Encrypt certificate for both names and the www and HTTPS redirects, as the earlier articles leave it; reached over SSH as a sudo user. HTTP/2 was also checked from another network. Every version above was read from the server at run time. Passwords used on the throwaway test server are shown as [password]. How we test: https://serverhandbook.com/how-we-test ------------------------------------------------------------------------------ Claims (25), each with what the run saw ------------------------------------------------------------------------------ 1. ok a bare Ubuntu 24.04 server box (web-server) starts 2. ok (setup) certbot got a certificate for example.com and www.example.com | Saving debug log to /var/log/letsencrypt/letsencrypt.log | Account registered. | Requesting a certificate for example.com and www.example.com | | Successfully received certificate. | Certificate is saved at: /etc/letsencrypt/live/example.com/fullchain.pem | Key is saved at: /etc/letsencrypt/live/example.com/privkey.pem | This certificate expires on 2027-02-11. | These files will be updated when the certificate renews. | Certbot has set up a scheduled task to automatically renew this certificate in the background. | | Deploying certificate | Successfully deployed certificate for example.com to /etc/nginx/sites-enabled/example.com | Successfully deployed certificate for www.example.com to /etc/nginx/sites-enabled/example.com | Congratulations! You have successfully enabled HTTPS on https://example.com and https://www.example.com | | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | If you like Certbot, please consider supporting our work by: | * Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate | * Donating to EFF: https://eff.org/donate-le | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3. ok before: curl talks HTTP/1.1 to https://example.com (curl offers h2; the server does not) | 1.1 4. ok Ubuntu’s nginx is built with http_v2_module and without http_v3_module | http_v2_module 5. ok nginx -v: nginx/1.24.0 (Ubuntu) | nginx version: nginx/1.24.0 (Ubuntu) 6. ok the file has four `listen … 443 ssl;` lines (two HTTPS blocks, IPv4 + IPv6) | 3: listen 80; | 4: listen [::]:80; | 11: listen 443 ssl; | 12: listen [::]:443 ssl; | 23: listen 443 ssl; | 24: listen [::]:443 ssl; 7. ok after sed: all four 443 lines read `443 ssl http2;`, the port-80 lines are unchanged | 3: listen 80; | 4: listen [::]:80; | 11: listen 443 ssl http2; | 12: listen [::]:443 ssl http2; | 23: listen 443 ssl http2; | 24: listen [::]:443 ssl http2; 8. ok nginx -t is successful | nginx: the configuration file /etc/nginx/nginx.conf syntax is ok | nginx: configuration file /etc/nginx/nginx.conf test is successful 9. ok after: curl talks HTTP/2 to https://example.com | 2 10. ok the status line is `HTTP/2 200` | HTTP/2 200 11. ok the www redirect also answers over HTTP/2: `HTTP/2 301` | HTTP/2 301 12. ok openssl: the TLS handshake picks `ALPN protocol: h2` | ALPN protocol: h2 13. ok (from another network) curl gets HTTP/2 200 | 2 200 14. ok plain http stays HTTP/1.1 (the redirect): `HTTP/1.1 301 Moved Permanently` | HTTP/1.1 301 Moved Permanently 15. ok `http2 on;` on nginx 1.24: [emerg] unknown directive "http2", test failed | 2026/11/13 19:12:39 [emerg] 3972#3972: unknown directive "http2" in /etc/nginx/conf.d/http2.conf:1 | nginx: configuration file /etc/nginx/nginx.conf test failed 16. ok (the file removed, nginx -t is successful again) | nginx: the configuration file /etc/nginx/nginx.conf syntax is ok | nginx: configuration file /etc/nginx/nginx.conf test is successful 17. ok http2 in the main block only: nginx -t is successful | nginx: the configuration file /etc/nginx/nginx.conf syntax is ok | nginx: configuration file /etc/nginx/nginx.conf test is successful 18. ok …and the www block, with no http2 on its lines, still answers HTTP/2 (same address and port) | HTTP/2 301 19. ok certbot renew --dry-run succeeds | Saving debug log to /var/log/letsencrypt/letsencrypt.log | | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | Processing /etc/letsencrypt/renewal/example.com.conf | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | Account registered. | Simulating renewal of an existing certificate for example.com and www.example.com | | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | Congratulations, all simulated renewals succeeded: | /etc/letsencrypt/live/example.com/fullchain.pem (success) | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 20. ok …and the four `ssl http2` lines are still there | 4 21. ok …and the site still answers HTTP/2 | 2 22. ok (tested on) the box reports its OS, kernel and the version of 5 package(s) | PRETTY_NAME="Ubuntu 24.04.4 LTS" | VIRT=none | KERNEL=6.8.0-138-generic | PKG certbot 2.9.0-1 | PKG curl 8.5.0-2ubuntu10.13 | PKG nginx 1.24.0-2ubuntu7.19 | PKG openssl 3.0.13-0ubuntu3.15 | PKG python3-certbot-nginx 2.9.0-1 23. ok undo: nginx -t successful | nginx: the configuration file /etc/nginx/nginx.conf syntax is ok | nginx: configuration file /etc/nginx/nginx.conf test is successful 24. ok undo: back to HTTP/1.1 | 1.1 25. ok (cleanup) the certificate the run got is revoked | Saving debug log to /var/log/letsencrypt/letsencrypt.log | Deleted all files relating to certificate example.com. | Congratulations! You have successfully revoked the certificate that was located at /etc/letsencrypt/live/example.com/cert.pem. ------------------------------------------------------------------------------ Commands and what they printed (25) ------------------------------------------------------------------------------ $ curl -sI https://example.com -o /dev/null -w '%{http_version}\n' 1.1 $ nginx -V 2>&1 | grep -oE 'http_v[23]_module' http_v2_module $ nginx -v nginx version: nginx/1.24.0 (Ubuntu) $ grep -n 'listen' /etc/nginx/sites-available/example.com 3: listen 80; 4: listen [::]:80; 11: listen 443 ssl; 12: listen [::]:443 ssl; 23: listen 443 ssl; 24: listen [::]:443 ssl; $ sudo cp /etc/nginx/sites-available/example.com ~/example.com.before-http2 $ sudo sed -i 's/listen \(.*\)443 ssl;/listen \1443 ssl http2;/' /etc/nginx/sites-available/example.com $ grep -n 'listen' /etc/nginx/sites-available/example.com 3: listen 80; 4: listen [::]:80; 11: listen 443 ssl http2; 12: listen [::]:443 ssl http2; 23: listen 443 ssl http2; 24: listen [::]:443 ssl http2; $ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful $ sudo systemctl reload nginx $ curl -sI https://example.com -o /dev/null -w '%{http_version}\n' 2 $ curl -sI https://example.com | head -n 1 HTTP/2 200 $ curl -sI https://www.example.com | head -n 1 HTTP/2 301 $ echo | openssl s_client -connect example.com:443 -servername example.com -alpn h2 2>/dev/null | grep -a ALPN ALPN protocol: h2 $ curl -sI http://example.com | head -n 1 HTTP/1.1 301 Moved Permanently $ echo 'http2 on;' | sudo tee /etc/nginx/conf.d/http2.conf http2 on; $ sudo nginx -t 2026/11/13 19:12:39 [emerg] 3972#3972: unknown directive "http2" in /etc/nginx/conf.d/http2.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed $ sudo rm /etc/nginx/conf.d/http2.conf $ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful $ curl -sI https://www.example.com | head -n 1 HTTP/2 301 $ sudo certbot renew --dry-run Saving debug log to /var/log/letsencrypt/letsencrypt.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Processing /etc/letsencrypt/renewal/example.com.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Account registered. Simulating renewal of an existing certificate for example.com and www.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations, all simulated renewals succeeded: /etc/letsencrypt/live/example.com/fullchain.pem (success) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $ grep -c 'ssl http2' /etc/nginx/sites-available/example.com 4 $ curl -sI https://example.com -o /dev/null -w '%{http_version}\n' 2 $ sudo sed -i 's/ ssl http2;/ ssl;/' /etc/nginx/sites-available/example.com $ sudo nginx -t && sudo systemctl reload nginx nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful $ curl -sI https://example.com -o /dev/null -w '%{http_version}\n' 1.1 ------------------------------------------------------------------------------ The check's source (scripts/live/checks/nginx-http2-ubuntu-24-04.mjs) As it ran. ------------------------------------------------------------------------------ /** * KB: enable HTTP/2 in Nginx on Ubuntu 24.04. See which protocol the site speaks now (HTTP/1.1 over HTTPS) and that * Ubuntu's nginx 1.24 has the HTTP/2 module but no HTTP/3; add `http2` to every `listen … 443 ssl` line; nginx -t and * reload; check it with curl (the site and the www redirect), with openssl (ALPN: h2), and from another network; * plain http stays HTTP/1.1; `http2 on;` (the nginx 1.25.1+ form) is an "unknown directive" here; HTTP/2 is per * address and port, so one block with it turns it on for every site on 443; renewal leaves the lines alone; undo. * * Runs ONLY on a real rented server (LIVE_VPS=root@
LIVE_VPS_DOMAIN=