Varnish source code installation and simple operation
Package link: https://pan.baidu.com/s/1WHfuPXUMxTENOcngjEWZZQ
First prepare the environment: two virtual machines: one 80.111 and one 80.112
Yum install lrz*-y install upload tool
Upload soft package and dependency package:
Libedit-devel-3.0-12.20121213cvs.el7.x86_64.rpm
Python-docutils-0.11-0.2.20130715svn7687.el7.noarch.rpm
Varnish-5.2.1.tgz
Yum install-y gcc gcc-c++ make / / install compiler and environment install dependency packages and required plug-ins: yum install-y\ libtool\ ncourses-devel\ pcre-devel\ libedit-devel\ libxslt\ groff\ pkgconfig\ ncurses-devel\ python-*rpm-ivh libedit-devel-3.0-12.20121213cvs.el7.x86_64.rpmrpm-ivh python-docutils-0.11-0.2.20130715svn7687.el7.noarch.rpm installation software tar xf varnish- 5.2.1.tgz-C / optcd / opt/varnish-5.2.1/ enter the decompressed folder to define the required modules.. / autogen.sh / / check the system environment
Install the dependency package. / configure\-prefix=/usr/local/varnish\-enable-debugging-symbols\-enable-developer-warningsmake & & make install / compile cd / usr/local/varnish/ln-s / usr/local/varnish/sbin/varnishd / usr/sbin/ln-s / usr/local/varnish/bin/* / usr/local/bin to create a soft connection cp / usr/local/varnish/share/doc/varnish/example.vcl / usr/local / varnish/default.vcl// configuration file template is copied out and modified with vi / usr/local/varnish/default.vclg: backend default {.host = "192.168.80.112" / / ip .port of the second virtual machine = "80"}
Save and exit after completion
Varnishd-f / usr/local/varnish/default.vcl-a 0.0.0.0 ip 80 / / # specify the listening ip and port launch varnishnetstat-anpt | grep varnishd to check whether the port is running
Build a web server on another linux virtual machine:
Yum install-y httpdvi / var/www/html/index.htmlserver 1systemctl start httpd test, enter http://192.168.80.111 (ip address of the varnish server) in the windows browser
Vi / etc/httpd/conf/httpd.conf directly enter / ServerName enter to delete the # in front of servername
Save exit
Start the httpd service: systemctl start httpd
Enter 192.168.80.111 (the IP address of the first server) in the browser
The web page written in the second virtual machine is considered a success.