0 Cli - Rd Ping 0 Cli - Wr 200 19 PONG 1340829925 1.0 12 Sessionopen c 79.124.74.11 3063 :80 12 SessionClose c EOF 12 StatSess c 79.124.74.11 3063 0 1 0 0 0 0 0 0 0 Cli - Rd Ping 0 Cli - Wr 200 19 PONG 1340829928 1.0 0 Cli - Rd Ping 0 Cli - Wr 200 19 PONG 1340829931 1.0 12 Sessionopen c 108.62.115.226 46211 :80 12 ReqStart c 108.62.115.226 46211 467185881 12 RxRequest c GET 12 RxURL c / 12 RxProtocol c http/1.0 12 Rxheader c User-Agent: Pingdom.com_bot_version_1.4_(http://www.Pingdom.com/) 12 Rxheader c Host: www.mysite.com 12 VCL_call c recv lookup 12 VCL_call c hash 12 Hash c / 12 Hash c www.mysite.com 12 VCL_return c hash 12 VCL_call c miss fetch 12 FetchError c no backend connection 12 VCL_call c error deliver 12 VCL_call c deliver deliver 12 TxProtocol c http/1.1 12 TxStatus c 503 12 TxResponse c Service Unavailable 12 Txheader c Server: Varnish 12 Txheader c Content-Type: text/HTML; charset=utf-8 12 Txheader c Retry-After: 5 12 Txheader c Content-Length: 418 12 Txheader c Accept-Ranges: bytes 12 Txheader c Date: Wed,27 Jun 2012 20:45:31 GMT 12 Txheader c X-Varnish: 467185881 12 Txheader c Age: 1 12 Txheader c Via: 1.1 varnish 12 Txheader c Connection: close 12 Length c 418 12 ReqEnd c 467185881 1340829931.192433119 1340829931.891024113 0.000051022 0.698516846 0.000074035 12 SessionClose c error 12 StatSess c 108.62.115.226 46211 1 1 1 0 0 0 256 418 0 Cli - Rd Ping 0 Cli - Wr 200 19 PONG 1340829934 1.0 0 Cli - Rd Ping 0 Cli - Wr 200 19 PONG 1340829937 1.0
netstat -tlnp Active Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:8080 0.0.0.0:* ListEN 3086/Nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* ListEN 1915/varnishd tcp 0 0 0.0.0.0:22 0.0.0.0:* ListEN 1279/sshd tcp 0 0 127.0.0.2:25 0.0.0.0:* ListEN 3195/sendmail: MTA:tcp 0 0 127.0.0.2:6082 0.0.0.0:* ListEN 1914/varnishd tcp 0 0 127.0.0.2:9000 0.0.0.0:* ListEN 1317/PHP-fpm.conf)tcp 0 0 127.0.0.2:3306 0.0.0.0:* ListEN 1192/MysqLd tcp 0 0 127.0.0.2:587 0.0.0.0:* ListEN 3195/sendmail: MTA:tcp 0 0 127.0.0.2:11211 0.0.0.0:* ListEN 3072/memcached tcp6 0 0 :::8080 :::* ListEN 3086/Nginx tcp6 0 0 :::80 :::* ListEN 1915/varnishd tcp6 0 0 :::22 :::* ListEN 1279/sshd
在/ etc / Nginx的/启用站点/默认
server { Listen 8080; ## Listen for ipv4; this line is default and implIEd Listen [::]:8080 default ipv6only=on; ## Listen for ipv6 root /usr/share/Nginx/www; index index.HTML index.htm index.PHP; # Make site accessible from http://localhost/ server_name localhost; location / { # First attempt to serve request as file,then # as directory,then fall back to index.HTML try_files $uri $uri/ /index.HTML; } location /doc { root /usr/share; autoindex on; allow 127.0.0.2; deny all; } location /images { root /usr/share; autoindex off; } #error_page 404 /404.HTML; # redirect server error pages to the static page /50x.HTML # #error_page 500 502 503 504 /50x.HTML; #location = /50x.HTML { # root /usr/share/Nginx/www; #} # proxy the PHP scripts to Apache Listening on 127.0.0.1:80 # #location ~ \.PHP${ # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server Listening on 127.0.0.1:9000 # location ~ \.PHP${ fastcgi_pass 127.0.0.2:9000; fastcgi_index index.PHP; include fastcgi_params; } # deny access to .htaccess files,if Apache's document root # concurs with Nginx's one # #location ~ /\.ht { # deny all; #}}
/etc/Nginx/sites-enabled/www.mysite.com.vhost
server { Listen 8080; server_name www.mysite.com mysite.com.net; root /var/www/www.mysite.com/web; if ($http_host != "www.mysite.com") { rewrite ^ http://www.mysite.com$request_uri permanent; } index index.PHP index.HTML; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Deny all attempts to access hIDden files such as .htaccess,.htpasswd,.DS_Store (Mac). location ~ /\. { deny all; access_log off; log_not_found off; } location / { try_files $uri $uri/ /index.PHP?$args; } # Add trailing slash to */wp-@R_419_5976@ requests. rewrite /wp-@R_419_5976@$$scheme://$host$uri/ permanent; location ~* \.(jpg|jpeg|png|gif|CSS|Js|ico)${ expires max; log_not_found off; } location ~ \.PHP${ try_files $uri =404; include /etc/Nginx/fastcgi_params; fastcgi_pass 127.0.0.2:9000; fastcgi_param SCRIPT_filename $document_root$fastcgi_script_name; }include /var/www/www.mysite.com/web/Nginx.conf; location ~ /Nginx.conf { deny all; access_log off; log_not_found off; }}
/etc/varnish/default.vcl# This is a basic VCL configuration file for varnish. See the vcl(7)# man page for details on VCL Syntax and semantics.# # Default backend deFinition. Set this to point to your content# server.# backend default { .host = "127.0.0.2"; .port = "8080"; # .connect_timeout = 600s; #.first_byte_timeout = 600s; # .between_bytes_timeout = 600s; # .max_connections = 800;
注意:在default.vcl中取消注释最后四个选项没有任何区别.
cat / etc / default / varnish
# Configuration file for varnish## /etc/init.d/varnish expects the variables $DAEMON_OPTS,$NfileS and $MEmlock# to be set from this shell script fragment.## Should we start varnishd at boot? Set to "yes" to enable.START=yes# Maximum number of open files (for ulimit -n)NfileS=131072# Maximum locked memory size (for ulimit -l)# Used for locking the shared memory log in memory. If you increase log size,# you need to increase this number as wellMEmlock=82000# Default varnish instance name is the local nodename. Can be overrIDden with# the -n switch,to have more instances on a single server.INSTANCE=$(uname -n)# This file contains 4 alternatives,please use only one.## Alternative 1,Minimal configuration,no VCL## Listen on port 6081,@R_419_5976@istration on localhost:6082,and forward to# content server on localhost:8080. Use a 1GB fixed-size cache file.## DAEMON_OPTS="-a :6081 \# -T localhost:6082 \# -b localhost:8080 \# -u varnish -g varnish \# -S /etc/varnish/secret \# -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"## Alternative 2,Configuration with VCL## Listen on port 6081,and forward to# one content server selected by the vcl file,based on the request. Use a 1GB# fixed-size cache file.#DAEMON_OPTS="-a :80 \ -T 127.0.0.2:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s file,1G"
如果您需要任何其他信息,请告诉我们.我完全不知道这个问题是什么.
curl header给了我这个:
curl -v -I -H "Testing: Test header so you see this works" http://www.mysite.com:8080* About to connect() to www.mysite.com port 8080 (#0)* Trying 176.31.158.78... connected* Connected to www.mysite.com (176.31.158.78) port 8080 (#0)> head / http/1.1> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5> Host: www.mysite.com:8080> Accept: */*> Testing: Test header so you see this works> < http/1.1 301 Moved Permanentlyhttp/1.1 301 Moved Permanently< Server: Nginx/1.0.5Server: Nginx/1.0.5< Date: Thu,28 Jun 2012 11:01:23 GMTDate: Thu,28 Jun 2012 11:01:23 GMT< Content-Type: text/HTMLContent-Type: text/HTML< Content-Length: 184Content-Length: 184< Connection: keep-aliveConnection: keep-alive< Location: http://www.mysite.com/Location: http://www.mysite.com/< * Connection #0 to host www.mysite.com left intact* Closing connection #0解决方法 您应该尝试使用varnish用户登录并使用curl或wget测试连接到Nginx后端(127.0.0.2:8080)以确保它按预期工作.
正如cyberx86在评论中所说,SElinux(或任何其他安全模块如apparmor,grsec等)可能存在问题,不允许服务之间的连接,您还应检查审核日志以确保它不会发生在您的服务器中.
如果您的后端工作不正常(Nginx执行错误),您将遇到此类问题,请尝试直接访问后端并检查日志以确保所有内容都按预期运行(pax在评论中也告诉您) .
总结以上是内存溢出为你收集整理的linux – Varnish“FetchError no backend connection”错误全部内容,希望文章能够帮你解决linux – Varnish“FetchError no backend connection”错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)