配置Varnish 和 web服务器
配置您的web服务器
配置Web服务器监听默认端口80以外的端口,因为Varnish直接响应传入的HTTP请求,而不是web服务器。
在后面的章节中,我们使用端口8080作为一个例子.
改变Apache 2.2监听端口:
- 打开 
/etc/httpd/conf/httpd.conf在文本编辑器中. - 查找
Listen指令. - 将端口的值更改为 
8080. - 保存更改 
httpd.conf. 
修改Varnish系统配置
- 打开 
/etc/sysconfig/varnish(或/etc/default/varnish在 Debian 和 Ubuntu) 在文本编辑器中. - 
              
设置Varnish 端口为 80:
VARNISH_LISTEN_PORT=80 - 
              
## Alternative 1, Minimal configuration, no VCL #DAEMON_OPTS="-a :6081 \ # -T localhost:6082 \ # -b localhost:8080 \ # -u varnish -g varnish \ # -s file,/var/lib/varnish/varnish_storage.bin,1G" ## Alternative 2, Configuration with VCL #DAEMON_OPTS="-a :6081 \ # -T localhost:6082 \ # -f /etc/varnish/default.vcl \ # -u varnish -g varnish \ # -S /etc/varnish/secret \ # -s file,/var/lib/varnish/varnish_storage.bin,1G" - 保存更改 
/etc/sysconfig/varnish. 
下一步
配置Magento 2使用Varnish