将Varnish放在80端口上

直到现在,出于测试目的,我们仍然是将Varnish运行在一个不常用的端口上面。现在就让我们来将它放到80端口上。

首先,你需要现将Varnish停掉:service varnish stop

现在我们需要编辑我们的配置文件。

Debian/Ubuntu

在Debian/Ubuntu系统上,我们编辑/etc/default/varnish文件,在这个文件中我们可以找到类似下面这样的一段内容:

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

将它们修改为下面这样:

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

Red Hat 企业版 Linux / CentOS

在Red Hat和CentOS系统中您可以在/etc/sysconfig/varnish文件中找到类似的配置。

重启Varnish

上面的配置修改完毕之后,就可以启动Varnish了:service varnish start

现在每个人访问您的网站都会通过Varnish访问了。

results matching ""

    No results matching ""