Installing varnish in a Linux environment

Source: Internet
Author: User
Tags varnish

Varnish is a high-performance open-source HTTP accelerator, and Norway's largest online newspaper, Verdens Gang, used 3 varnish instead of the original 12 squid for better performance than before.

sudo apt-get install varnish-y

First, delete the/etc/varnish/default.vcl file and create a symbolic link from the exported varnish configuration:

sudo rm -rf /etc/varnish/default.vclsudo ln -s /var/www/html/magento/var/varnish.vcl /etc/varnish/default.vcl

Next, you will need to create a SYSTEMD service file for varnish. You can varnish.service from/lib/systemd/system/Copy to/Etc/systemd/system/directory:

sudo cp /lib/systemd/system/varnish.service /etc/systemd/system/

After you copy the file, you will need to make some changes to the Varnish.service file:

sudo nano /etc/systemd/system/varnish.service

Make the following changes:

[Unit]Description=Varnish HTTP acceleratorDocumentation=https://www.varnish-cache.org/docs/4.1/ man:varnishd[Service]Type=simpleLimitNOFILE=131072LimitMEMLOCK=82000ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256mExecReload=/usr/share/varnish/reload-vclProtectSystem=fullProtectHome=truePrivateTmp=truePrivateDevices=true[Install]WantedBy=multi-user.target

Save the file when you are finished, and then restart the varnish service by using the following command:

sudo systemctl daemon-reloadsudo systemctl reload varnish.service

If everything works, you should be able to log on to the Magento backend by entering the following URL on your Web browser:

http://192.168.15.189/admin_wczta4

You can also check whether varnish is enabled by running the following command:

curl -I http://192.168.15.189/admin_wczta4

You should see that varnish is enabled:

Date: Fri, 07 Jul 2017 17:10:01 GMTServer: Apache/2.4.18 (Ubuntu)Set-Cookie: store=default; expires=Sat, 07-Jul-2018 17:10:03 GMT; Max-Age=31536000; path=/; HttpOnlySet-Cookie: PHPSESSID=irp2k8cmrhct0dfh18qk7ap0i4; expires=Fri, 07-Jul-2017 18:10:04 GMT; Max-Age=3600; path=/; domain=192.168.15.189; HttpOnlyExpires: Thu, 07 Jul 2016 17:10:04 GMTCache-Control: max-age=0, must-revalidate, no-cache, no-storePragma: no-cacheLocation: http://192.168.15.189/admin_wczta4/?SID=irp2k8cmrhct0dfh18qk7ap0i4X-Content-Type-Options: nosniffX-XSS-Protection: 1; mode=blockX-Frame-Options: SAMEORIGINContent-Length: 0Content-Type: text/html; charset=UTF-8X-Varnish: 2Age: 0Via: 1.1 varnish-v4Connection: keep-alive

Installing varnish in a Linux environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.