zoukankan      html  css  js  c++  java
  • linux环境下安装varnish

    Varnish是一款高性能的开源HTTP加速器,挪威最大的在线报纸 Verdens Gang 使用3台Varnish代替了原来的12台Squid,性能比以前更好。

    sudo apt-get install varnish -y

    首先,删除/etc/varnish/default.vcl文件并从导出的Varnish配置创建一个符号链接:

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

    接下来,您将需要为Varnish创建一个systemd服务文件。 您可以将varnish.service从/ lib / systemd / system /复制到/ etc / systemd / system /目录中:

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

    复制该文件后,您将需要对varnish.service文件进行一些更改:

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

    进行以下更改:

    [Unit]
    Description=Varnish HTTP accelerator
    Documentation=https://www.varnish-cache.org/docs/4.1/ man:varnishd
    
    [Service]
    Type=simple
    LimitNOFILE=131072
    LimitMEMLOCK=82000
    ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
    ExecReload=/usr/share/varnish/reload-vcl
    ProtectSystem=full
    ProtectHome=true
    PrivateTmp=true
    PrivateDevices=true
    
    [Install]
    WantedBy=multi-user.target
    

    完成后保存文件,然后使用以下命令重新启动Varnish服务:

    sudo systemctl daemon-reload
    sudo systemctl reload varnish.service
    

    如果一切正常,那么您应该能够通过在Web浏览器上输入以下URL来登录到Magento后端:

    http://192.168.15.189/admin_wczta4
    

    您还可以通过运行以下命令来检查是否启用了Varnish:

    curl -I http://192.168.15.189/admin_wczta4
    

    您应该看到Varnish已启用:

    Date: Fri, 07 Jul 2017 17:10:01 GMT
    Server: Apache/2.4.18 (Ubuntu)
    Set-Cookie: store=default; expires=Sat, 07-Jul-2018 17:10:03 GMT; Max-Age=31536000; path=/; HttpOnly
    Set-Cookie: PHPSESSID=irp2k8cmrhct0dfh18qk7ap0i4; expires=Fri, 07-Jul-2017 18:10:04 GMT; Max-Age=3600; path=/; domain=192.168.15.189; HttpOnly
    Expires: Thu, 07 Jul 2016 17:10:04 GMT
    Cache-Control: max-age=0, must-revalidate, no-cache, no-store
    Pragma: no-cache
    Location: http://192.168.15.189/admin_wczta4/?SID=irp2k8cmrhct0dfh18qk7ap0i4
    X-Content-Type-Options: nosniff
    X-XSS-Protection: 1; mode=block
    X-Frame-Options: SAMEORIGIN
    Content-Length: 0
    Content-Type: text/html; charset=UTF-8
    X-Varnish: 2
    Age: 0
    Via: 1.1 varnish-v4
    Connection: keep-alive
  • 相关阅读:
    python 希尔排序
    python 选择排序
    python 插入排序
    怎么根据返回数量,来渲染点赞星星的个数变高量?
    avalon $computed不起作用?
    移动端点击事件兼容问题,在pc端可以点,在手机上不可以点
    移动端弹出遮罩层禁止页面滚动,遮罩里面的框允许滚动如何实现。
    移动端,如何禁止弹窗下面内容滚动/页面滚动
    avalon数据已更新,视图未更新的bug修复
    Python 导入分部分项前的 数据处理
  • 原文地址:https://www.cnblogs.com/tirmer/p/8667845.html
Copyright © 2011-2022 走看看