Configure Varnish (TM) for WordPress

To make Varnish (TM) receive the HTTP requests on port 80, Apache needs to be moved to port 81. To do so, follow these steps:

  • Access your WordPress server through SSH.

  • Rename the Varnish (TM) config file as shown below:

          $ sudo cp /opt/bitnami/varnish/conf/wordpress.vcl.disabled/wordpress.vcl.disabled /opt/bitnami/varnish/conf/default.vcl
  • Change the listening ports in Apache by executing the commands below:

          $ sudo sed -i 's/Listen 80/Listen 81/' /opt/bitnami/apache/conf/httpd.conf
          $ sudo sed -i 's/:80/:81/' /opt/bitnami/apache/conf/vhosts/00_status-vhost.conf
          $ sudo sed -i 's/:80/:81/g' /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf

    NOTE: These instructions are for the default Bitnami Apache configuration. If you have configured new Apache virtual hosts, you have to update those definitions accordingly.

  • Restart all services:

          $ sudo service bitnami restart

Varnish is a registered trademark of Varnish Software AB and its affiliates.

Last modification July 8, 2020