Configure Varnish on Ubuntu 18.04 for backend webserver

The installation of varnish is pretty forward on Ubuntu 18.04 as before, but the configuration of varnish is a little tricky on this sytemd enabled Ubuntu 18.04.

The main purpose for this task is to setup varnish to serve on 80 and backend nginx running on 8080. All most all the steps following posts from https://idroot.net/linux/install-varnish-cache-ubuntu-18-04-lts/ goes very well except for varnish is still running on default port 6081 instead of 80.

Then here’s the magic line:

Configure port 80 in /lib/systemd/system/varnish.service

Thanks to https://linuxconfig.org/how-to-install-varnish-cache-server-with-nginx-on-ubuntu-18-04-bionic-beaver-linux !!! You saved on morning for me!

Now I could access following sites runing behind this varnish server:

Happy Ending!

http://www.viqsoft.com/blog/2018/09/12/configure-varnish-on-ubuntu-18-04-for-backend-webserver/

华为云优惠多多,更有新用户低至4折,欢迎点击此处或者扫码进入