Varnish on stand-alone server

Miguel González miguel_3_gonzalez at yahoo.es
Sun Jan 22 11:59:21 CET 2017


What about the acl purge list in the default.vcl file?


On 01/21/17 7:04 PM, Stalker, Tim wrote:
> Yes, when I point the backend host to the ip of the varnish virtual
> machine in my host computer's /etc/hosts file, I get this response in
> the varnish log on the varnish vm:
> 
> 
> *   << BeReq    >> 17        
> -   Begin          bereq 16 fetch
> -   Timestamp      Start: 1485021291.247201 0.000000 0.000000
> -   BereqMethod    GET
> -   BereqURL       /
> -   BereqProtocol  HTTP/1.1
> -   BereqHeader    Host: clas-test.myvhost.pvt
> -   BereqHeader    Upgrade-Insecure-Requests: 1
> -   BereqHeader    User-Agent: Mozilla/5.0 (X11; Linux x86_64)
> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
> -   BereqHeader    Accept:
> text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
> -   BereqHeader    Accept-Language: en-US,en;q=0.8
> -   BereqHeader    X-Forwarded-For: 192.168.33.1
> -   BereqHeader    Accept-Encoding: gzip
> -   BereqHeader    X-Varnish: 17
> -   VCL_call       BACKEND_FETCH
> -   VCL_return     fetch
> -   FetchError     no backend connection
> -   Timestamp      Beresp: 1485021291.247212 0.000011 0.000011
> -   Timestamp      Error: 1485021291.247215 0.000013 0.000002
> -   BerespProtocol HTTP/1.1
> -   BerespStatus   503
> -   BerespReason   Service Unavailable
> -   BerespReason   Backend fetch failed
> -   BerespHeader   Date: Sat, 21 Jan 2017 17:54:51 GMT
> -   BerespHeader   Server: Varnish
> -   VCL_call       BACKEND_ERROR
> -   BerespHeader   Content-Type: text/html; charset=utf-8
> -   VCL_return     deliver
> -   Storage        malloc Transient
> -   ObjProtocol    HTTP/1.1
> -   ObjStatus      503
> -   ObjReason      Backend fetch failed
> -   ObjHeader      Date: Sat, 21 Jan 2017 17:54:51 GMT
> -   ObjHeader      Server: Varnish
> -   ObjHeader      Content-Type: text/html; charset=utf-8
> -   Length         27910
> -   BereqAcct      0 0 0 0 0 0
> -   End            
> 
> 
> *   << Session  >> 163842    
> -   Begin          sess 0 HTTP/1
> -   SessOpen       192.168.33.1 40398 :80 192.168.33.27 80
> 1485021291.241650 16
> -   SessClose      RX_TIMEOUT 5.094
> -   End            
> 
> *   << Session  >> 131074    
> -   Begin          sess 0 HTTP/1
> -   SessOpen       192.168.33.1 40400 :80 192.168.33.27 80
> 1485021291.241657 17
> -   SessClose      RX_TIMEOUT 5.094
> -   End            
> 
> *   << Session  >> 15        
> -   Begin          sess 0 HTTP/1
> -   SessOpen       192.168.33.1 40396 :80 192.168.33.27 80
> 1485021291.241622 14
> -   Link           req 16 rxreq
> -   Link           req 18 rxreq
> -   SessClose      RX_TIMEOUT 5.395
> -   End          
> 
> 
> Any ideas? I can only think that it's a networking issue because the
> same setup I have, same default.vcl, backends.vcl files, with apache
> installed on the same VM as varnish, works fine. The backend host when
> separate from varnish in its own VM also works fine. But varnish cannot
> connect to it.
> 
> ------------------------------------------------------------------------
> *From:* Miguel González <miguel_3_gonzalez at yahoo.es>
> *Sent:* Friday, January 20, 2017 3:18:51 PM
> *To:* Stalker, Tim; Andreas Plesner; varnish-misc at varnish-cache.org
> *Subject:* Re: Varnish on stand-alone server
>  
> What about the acl purge entries?
> 
> You probably know that you have to add in your hosts file where you are
> running your browser you have to point the domain you are hitting with
> the ip address of your varnish VM, don´t you?
> 
> Miguel
> 
> 
> 
> 
> On 01/20/17 5:38 PM, Stalker, Tim wrote:
>> I can't provide much detail because I don't get any reports or data from
>> varnishlog. No errors are reported. When I run "varnishadm
>> backend.list", the backend is reported as healthy. Plus, there's no
>> issues with varnish communicating with the backend when I visit the
>> backend host from within the varnish virtual machine. Everything works
>> as intended when I run a web client (curl or lynx) from the varnish vm
>> terminal. The problem is varnish doesn't communicate with the backend
>> when I visit the backend host from outside the vm on my host computer's
>> web browser.
>> 
>> 
>> The setup is is this - two virtual machines running in vagrant and
>> virtualbox
>> 
>> 
>> 192.168.33.26 (apache box with hostname clas-test.myhost.pvt listening
>> on port 84)
>> 
>> 192.168.33.27 (clas-varnish.myhost.pvt)
>> 
>> 
>> From default.vcl:
>> 
>> 
>> vcl 4.0;
>> import std;
>> import directors;
>> 
>> include "backends.vcl";
>> 
>> sub vcl_init {
>> 
>>     new local_test = directors.round_robin();
>>     local_test.add_backend(express_test);
>> }
>> sub vcl_recv {
>> 
>>   if (server.hostname == "clas-test.hostname.pvt") {
>>     set req.backend_hint = local_test.backend();
>>   }
>> }
>> sub vcl_deliver {
>>   if (obj.hits > 0) {
>>     set resp.http.X-Cache = "HIT";
>>     std.log("hitmiss:HIT");
>>   } else {
>>     set resp.http.X-Cache = "MISS";
>>     std.log("hitmiss:MISS");
>>   }
>> }
>> 
>> From backends.vcl:
>> 
>> 
>> backend express_test {
>>   .host = "192.168.33.26"; #ip of my host in its own virtual machine
>>   .port = "84"; #port I have set in the virtual host on my host's
>> virtual machine
>> }
>> 
>> In /etc/varnish/varnish.params I have the VARNISH_LISTEN_PORT set to
>> port 80 and VARNISH_LISTEN_ADDRESS commented out. Note, that when I set
>> the address to my backend ip, varnish won't start and I get this error:
>> 
>> bind(): Cannot assign requested address
>> [19743]: Error: Failed to open (any) accept sockets.
>> 
>> And yet when I run "varnishadm backend.list" with the listen address
>> commented out, the backend is reported as healthy.
>> 
>> Thanks again, all
>> 
>> 
>> 
>> ------------------------------------------------------------------------
>> *From:* varnish-misc-bounces+tim.stalker=ucdenver.edu at varnish-cache.org
>> <varnish-misc-bounces+tim.stalker=ucdenver.edu at varnish-cache.org> on
>> behalf of Andreas Plesner <apj at mutt.dk>
>> *Sent:* Friday, January 20, 2017 2:59:10 AM
>> *To:* varnish-misc at varnish-cache.org
>> *Subject:* Re: Varnish on stand-alone server
>>  
>> On Thu, Jan 19, 2017 at 06:23:56PM +0000, Stalker, Tim wrote:
>>> Varnish is aware of the backend I have set and works fine as long as I'm
>>> logged into its virtual machine and run either curl or lynx to the address of
>>> the machine with apache running. I have my /etc/hosts file set with the
>>> backend address and virtual host as configured in the apache box, but it
>>> seems that varnish ignores the /etc/hosts file. I get logging and see the
>>> headers when I run curl -I
>>> http://backend.vhost.name<http://backend.vhost.name/> but when I do the same
>>> thing via the browser, curl, or lynx on my host computer, no logging, nothing
>>> happens inside the varnish vm.
>> 
>> You're not giving us any info that actually enables us to help you. What
>> doesn't work? What error messages do you get? What did you already try? What
>> were the results of these attempts? What is in the log?
>> 
>> Most important is:
>> 
>> What doesn't work? You've only stated that it doesn't work, not what is
>> actually happening when you've determined that it doesn't work.
>> 
>> -- 
>> Andreas
>> 
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>> 
>> 
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>> 
> 




More information about the varnish-misc mailing list