【问题标题】:Explaination about this step in Varnish DocumentationVarnish 文档中有关此步骤的说明
【发布时间】:2012-03-03 10:27:46
【问题描述】:

步骤:https://www.varnish-cache.org/docs/3.0/tutorial/putting_varnish_on_port_80.html

这些是我的单个步骤:

1) pkill varnishd (完成!)

2) 编辑您的网络服务器的配置,使其绑定到端口 8080 而不是 80"

这一步是什么意思?我使用 Apache

3) default.vcl 并将默认后端的端口更改为 8080 (完成!)

4) varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 (完成!)

清漆不起作用,因为我跳过了第三步。我必须在那里做什么?解释单个步骤...

PS:有什么比 Varnish 更简单的替代品?

【问题讨论】:

    标签: apache caching varnish


    【解决方案1】:

    我假设 Varnish 和 Apache 都由同一台机器提供服务,因为您需要更改端口。标准的 www 端口是 80。您希望 Varnish 为该端口提供服务,并将请求转发到将在另一个端口 (8080) 上运行的 Apache。

    我不经常配置Apache的端口,但我认为下面的描述应该可以。编辑 httpd.conf 文件(通常在“/etc/httpd/conf/httpd.conf”中找到)并将端口设置从“Port 80”更改为“Port 8080”,然后重新启动 apache。如果存在,您可能还需要将“Listen 80”更改为“Listen 8080”。

    【讨论】:

      【解决方案2】:

      如果您使用的是 Debian,请参考以下说明:

      1. 停止清漆:sudo /etc/init.d/apache2 stop

      2. 停止 Apache:sudo /etc/init.d/varnish stop

      3. /etc/apache2/ports.conf 中将Listen 80 更改为Listen 8080

      4. 将所有虚拟主机更新为端口 8080,在 /etc/apache2/sites-available/* 中将 <VirtualHost xxxxxxxxxxx:80> 更改为 <VirtualHost xxxxxxx*:8080>

      5. /etc/default/varnish 中更改以下代码:

        DAEMON_OPTS="-a :6081 \ -T 本地主机:6082 \ -f /etc/varnish/default.vcl \ -S /etc/清漆/秘密\ -s malloc,256m"

      通过以下

      DAEMON_OPTS="-a :8080 \                     <======== THIS LINE
                   -T localhost:6082 \
                   -f /etc/varnish/default.vcl \
                   -S /etc/varnish/secret \
                   -s malloc,256m"
      

      并在/etc/varnish/default.vcl 中使用以下代码声明您的后端:

      backend default {
          .host = "127.0.0.1";
          .port = "8080";
      }
      
      1. 启动 Apache:sudo /etc/init.d/apache2 start

      2. 开始清漆:sudo /etc/init.d/varnish start

      【讨论】:

      • 关闭,但 Varnish 需要监听 80 端口:DAEMON_OPTS="-a :80 \ -T localhost:6082...
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多