tail -f /var/log/syslog
-
May 1 14:45:11 server varnishd[1662]: Child start failed: could not open sockets
May 1 14:45:17 server varnishd[1688]: Child start failed: could not open sockets
-
漆:
root@server:~# varnishd -V
varnishd (varnish-2.1.4 SVN )
Copyright (c) 2006-2009 Linpro AS / Verdens Gang AS
-
/etc/default/varnish 中的变化
# Should we start varnishd at boot? Set to "yes" to enable.
START=yes
- 修改了默认端口号:
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"
default.vcl 中的变化
backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
.max_connections = 800;
启动清漆给我这个:
root@server:~# service varnish restart
* Stopping HTTP accelerator varnishd [fail]
* Starting HTTP accelerator varnishd [ OK ]
运行 nginx、php5-fpm、apc、memchache、varnish、mysql、wordpress 的服务器。
可能是什么问题?感谢您的帮助。
root@server:~# sudo netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 2009/nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2009/nginx
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1271/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1408/sendmail: MTA:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 1300/main.conf)
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1239/mysqld
tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN 1408/sendmail: MTA:
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 1204/memcached
tcp6 0 0 :::80 :::* LISTEN 2009/nginx
tcp6 0 0 :::22 :::* LISTEN 1271/sshd
答案1
您已经有 nginx 在监听 80 端口,并且您已经告诉 Varnish 在 80 端口上监听。对于任何IP address:port
组合,只有其中一个可以执行此操作。
因为你有 nginx还监听端口 8080,并且您已将 Varnish 配置为使用端口 8080 作为后端,您可能希望完全停止 nginx 监听端口 80。