Linux Installation Configuration varnish Web Accelerator
Varnish is a high-performance open-source HTTP accelerator that can be used for purely proxy servers, load balancing, but Varnish's primary function is cache acceleration, which is also the best place for it. The following describes how to install and use.
- Wget-c http://repo.varnish-cache.org/source/varnish-3.0.1.tar.gz
- Tar xzvf varnish-3.0.1.tar.gz
- CD varnish-3.0.1
- ./configure--prefix=/usr/local/varnish
- Make
- Make install
- Groupadd Varnish
- useradd-d/var/lib/varnish-g varnish-s/sbin/nologin Varnish
- Ln-s/usr/local/varnish/sbin/varnishd/usr/sbin/varnishd
Start varnish:
- Varnishd-f/usr/local/varnish/etc/varnish/default.vcl-s malloc,1g-g varnish-u varnish-t 127.0.0.1:2000
Close varnish:
- Pkill Varnish
Introduction to Startup Parameters:
-f/usr/local/etc/varnish/default.vcl
This –f option specifies which configuration file varnishd uses.
-S MALLOC,1G
This –s option is used to determine the storage type and storage capacity used by varnish, I am using the malloc type (malloc is a C function for allocating memory space), and 1G defines how much memory is malloced,1g = 1gigabyte.
-T 127.0.0.1:2000
Varnish has a text-based management interface that can be activated to manage varnish without stopping varnish. You can specify which interface the management software listens to. Of course you can't allow people all over the world to access your varnish management interface, because they can easily access the varnish management interface to gain access to your root. I recommend that you just let it listen to the native port. If you have users in your system that you do not fully trust, you can restrict access to varnish's management ports through firewall rules.
-A 0.0.0.0:8080
The meaning of this sentence is to make varnish listen to all IP to 8080 port HTTP request, if in production environment, you should let varnish listen 80, this is also the default.
For an introduction to VCL configuration files, follow the instructions on how to view:
Man/usr/local/varnish/share/man/man7/vcl.7
You can also view the online documentation: https://www.varnish-cache.org/docs/3.0/
Reprint please indicate the article source: "https://www.centos.bz/2011/10/linux-install-varnish-cache-server/"
Linux Installation Configuration varnish Web Accelerator