nicolargo / varnish-nginx-wordpress

A "simple" Varnish ang NGinx configuration for a Wordpress blog
307 stars 86 forks source link

http://www.isvarnishworking.com/ saying "no varnish " why? #21

Open TOMER628 opened 9 years ago

TOMER628 commented 9 years ago

hi !

i using your Default.vcl .. i checked in http://www.isvarnishworking.com/ website, if my varnish (4) working.. and he said " NOPE ! " how this possible ?

here my config details:

let say my server ip is :123.123.123.123

so this my configuration of Default.vcl:

backend default { .host = "123.123.123.123"; .port = "8080"; .connect_timeout = 600s; .first_byte_timeout = 600s; .between_bytes_timeout = 600s; .max_connections = 800; }

Only allow purging from specific IPs

acl purge { "localhost"; "127.0.0.1"; }

and in Nginx.conf :

server { listen 123.123.123.123:80; server_name mydomain.com www.mydomain.com; error_log /var/log/httpd/domains/mydomain.com.error.log error;

location / {
    proxy_pass      http://123.123.123.123:6081;

    proxy_cache cache;
    proxy_cache_valid 15m;
    proxy_cache_valid 404 1m;
    proxy_no_cache $no_cache;
    proxy_cache_bypass $no_cache;
    proxy_cache_bypass $cookie_session $http_x_update;

    location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html$
        proxy_cache    off;
        root           /home/admin/web/mydomain.com/public_html;
        access_log     /var/log/httpd/domains/mydomain.com.log combined;
        access_log     /var/log/httpd/domains/mydomain.com.bytes bytes;
        expires        max;
        try_files      $uri @fallback;
    }
}

location /error/ {
    alias   /home/admin/web/mydomain.com/document_errors/;
}

location @fallback {
    proxy_pass      http://123.123.123.123:6081;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/admin/conf/web/nginx.mydomain.com.conf*;

}

i think this configurated correct. so why http://www.isvarnishworking.com/ say no varnish ?

Nope! We didn't find the "X-Varnish" header in the response from the server so likely Varnish is, in fact, not working.

Shoot.

It is possible that the Varnish daemon is technically running on the server, but maybe listening on another port. It's also possible someone modified the headers in your Varnish installation - in which case you're out of luck pal!

And here, for you to ponder further, are the actual headers we received:

The url we checked: mydomain.com HTTP/1.1 200 OK Date: Tue, 06 Jan 2015 08:11:37 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Set-Cookie: __cfduid=d235e8244a0187f446c95c59f836c4abc1420531897; expires=Wed, 06-Jan-16 08:11:37 GMT; path=/; domain=.mydomain.com; HttpOnly X-Pingback: http://mydomain.com/xmlrpc.php Link: http://wp.me/58zon; rel=shortlink Age: 42026 X-Cache: cached Server: cloudflare-nginx CF-RAY: 1a4672293c930697-EWR Content-Encoding: gzip

And the headers we sent:

HEAD / HTTP/1.1

Host: mydomain.com Accept: / Accept-Encoding: gzip, deflate Check another site!

regards, Tomer.

Oyabi commented 9 years ago

Hi, can you try :

backend default {
  .host = "127.0.0.1";
  ...
}

Regards.

TOMER628 commented 9 years ago

i changed that to 127.0.0.1 and i did restart to NGINX +VARNISH and after that cecked the website this my result:

Error 503 Backend fetch failed

Backend fetch failed

Guru Meditation:

XID: 3

Varnish cache server

Q-efx commented 9 years ago

Your server needs to listen on 127.0.0.1 to or the nginx won´t be able to resolve the request from Varnish to the correct domain.

X-Cache: cached, tells you already that the page cache (varnish is working correctly)or was lol.

That´s what you need to see, because in the default vcl they removed all "mentions" of varnish (preventing website scans from Bots for security holes for example)

And I´m not sure for what the Proxy pass is? You go through Varnish, than to nginx than to..? .. Something else?

TOMER628 commented 9 years ago

i using VESTACP and they said (attached link) to change to ip server... https://forum.vestacp.com/viewtopic.php?f=19&t=3793

see the answer of " Ghulam " he explained what to do and this what i did...

Q-efx commented 9 years ago

Well, still point stands, your page was cached...

X-Cache: cached