Tutorial

How to Enable HTTP/2 NGINX WordPress bitnami

Enable HTTP/2 on your webserver and speed up your blog, website, or application. HTTP/2 improves the speed by loading all scripts, CSS parallel instead of one by one. You can read more about HTTP/2 at Google official.

Enable HTTP/2 in Bitnami NGINX
Enable http2 in Bitnami NGINX

How HTTP/2 speeds up a website or blog.

On HTTP1.1 every component of the website loads one after other but in this new technology, each type of file loads together synchronous. That means it loads all CSS files in once and then JS and so the time taken is less than that of HTTP/1.1. So it will be a good practice to enable HTTP/2 for your web server.

How to Enable HTTP/2?

You can enable HTTP/2 just by editing bitnami.conf file of your bitnami WordPress nginx stack. To do this you’ve to execute the following command.

sudo -i
nano opt/bitnami/nginx/conf/bitnami/bitnami.conf

Now bitnami.conf file will open up, you’ve to add http2 in the 443 server connection block as displayed below.

server {
        listen 443 ssl http2;
        server_name  localhost;
       ssl_certificate      server.crt;
       ssl_certificate_key  server.key;
        ssl_certificate      
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_session_tickets off;
        ssl_stapling on;
        ssl_stapling_verify on;
        ssl_ciphers  HIGH:!aNULL:!MD5;
#       ssl_prefer_server_ciphers  on;
#        include "/opt/bitnami/nginx/conf/bitnami/phpfastcgi.conf";
       include "/opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf";
    }

Save the settings by pressing ctrl+X, then Y and then press enter.

Now you can check that all the settings you made are correct using the following command line.

nginx -t

If all settings are correct, you can restart nginx to load new configuration.

sudo /opt/bitnami/ctlscript.sh restart nginx

After the restart, you can check the http2 status of your website, which will result as enabled. Improve server security by hiding the nginx server version.

Ashok Kumar

Love Coding, Love Blogging what else to explain :).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button