Your Heart's A Bird Without The Wings To Fly
Magento2安装Varnish6.3
Magento2安装Varnish6.3

Magento2安装Varnish6.3

1.打开网页,添加源进行安装

官方文档:http://varnish-cache.org/docs/6.3/
下载链接:https://packagecloud.io/varnishcache/varnish63/packages/ubuntu/bionic/varnish-dev_6.3.2-1~bionic_amd64.deb

2.查看表头

curl -I localhost:6081
X-Varnish: 32770
Age: 0
Via: 1.1 varnish (Varnish/6.3)
Connection: keep-alive

3.修改varnish.service

  备 份
# sudo cp /lib/systemd/system/varnish.service   /etc/systemd/system/
# sudo vim /etc/systemd/system/varnish.service
6081 修改为80

4.修改default.vcl

备份
# sudo cp /etc/varnish/default.vcl /etc/varnish/default.vcl.bak
# sudo vim /etc/varnish/default.vcl
登陆后台修改指向端口8080,下载varnish配置文件

5.修改Apache2的3个默认端口

# sudo vim /etc/apache2/ports.conf
将最上面的Listen改为8080

# sudo vim /etc/apache2/sites-available/000-default.conf
将<VirtualHost *:80>改为<VirtualHost 127.0.0.1:8080>

# sudo vim /etc/apache2/sites-available/luban-saudi.com.conf
改为<VirtualHost *:8080>

6.重启服务

# sudo systemctl daemon-reload 
# sudo service varnish restart
# sudo service apache2 restart

7.查看表头

# curl -I localhost

X-Varnish: 32770
Age: 0
Via: 1.1 varnish (Varnish/6.3)
Connection: keep-alive

Leave a Reply

Your email address will not be published. Required fields are marked *