Khandaker Toihidul Islam
Front-end Developer
React Js | Javascript | HTML | CSS | Bootstrap | Wordpress | PHP | Mysql

Enable http2 in Digitalocean nginx linux server

  1. Edit /etc/nginx/sites-available/your_domain
...
    listen [::]:443 ssl;
    listen 443 ssl;
...

Have to add http2 after ssl as bellow

...
    listen [::]:443 ssl http2;
    listen 443 ssl http2;
...

Add # tag before bellow line

# include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot<^>

Now have to add bellow lines after above line

ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;

2. Have run this command

ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com

3. Check the server set up by run the command

sudo nginx -t

If test is success then need to restart the server as bellow

sudo systemctl reload nginx.service

4. Finally we can check as bellow

curl -I -L --http2 https://your_domain

The output should like

HTTP/2 200
server: nginx/1.18.0 (Ubuntu)
date: Wed, 10 Nov 2021 17:53:10 GMT
content-type: text/html
content-length: 612
last-modified: Tue, 09 Nov 2021 23:18:37 GMT
etag: "618b01cd-264"
accept-ranges: bytes

You may also like...