-1

I've been futzing around with getting this set up however I don't know if Varnish supports what I am trying to do:

  1. I have a server (ec2) thats running Nginx/Magento for ecommerce (www.domain/)
  2. On the same server, in a subdirectory of Magento, I am running Wordpress (www.domain/blog/)

Both of these are being fronted by an instance of Varnish and things are happy(tm), however, for monitoring and performance reasons I want to move the Wordpress instance off onto its own server and then point Varnish at that server for blog requests while keeping it pointed at the existing Nginx/Magento for ecommerce.

I have already tried having my sysadmin set this up using the example VCL files from Varnish but there were issues w/ requests for Magento that Varnish was sending over to Wordpress which then showed up as 404s.

Do I just need to work out a properly configured VCL file? Am I missing anything else? Does anyone have a working example of a VCL file that does this?

Matthew
  • 13
  • 1

1 Answers1

3

Just redirect the traffic to different backend based on that specific URI

backend wordpress {
  .host = "my.other.server.ip";
  .port = "80";
}

sub vcl_recv {
  if (req.url ~ "^/blog" && req.http.Host ~ "(.*)domain.com") {
    set req.backend = wordpress;
  }
Ben Lessani
  • 5,244
  • 17
  • 37