backend default {I am running my web server on port 8080 on the front facing server and on the default port 80 on for the backoffice one. Varnish will rewrite the host request to the corresponding virtual host on the backoffice, cache the results and even follow redirects without changing the URL line in the browser.
.host = "localhost";
.port = "8080";
}
backend backoffice {
.host = "backoffice.example.net";
.port = "80";
}
sub vcl_recv {
if (req.http.host == "host.example.net") {
#You will need the following line only if your backend has multiple virtual host names
set req.http.host = "otherhost.example.net";
set req.backend = backoffice;
return (lookup);
}
set req.backend = default;
return(pass);
}
sub vcl_fetch {
if (beresp.status == 302) {
set beresp.http.X-Magic-Redirect = "1";
return(deliver);
}
}
sub vcl_hit {
if (obj.http.X-Magic-Redirect == "1") {
set req.url = obj.http.Location;
return (restart);
}
}
sub vcl_deliver {
if (resp.http.X-Magic-Redirect == "1") {
unset resp.http.X-Magic-Redirect;
return(restart);
}
return(deliver);
}
Wednesday, October 17, 2012
Varnish for multiple hosts, following redirects
Using Varnish 3.x for two servers, caching the remote one and following redirects internally.
Upgrading ImageMagick on CentOS 5.6
You are special, you are unique and so is just about anyone else. This also means that whatever question you have, most chances are others have asked it before. There's a reasonable chance someone even answered it, more than once.
So instead of reinventing the wheel with every problem or challenge I face, I turn to google to see if someone has already solved it before.
Not every time I find an answer, sometimes there is an answer but it simply doesn't work for me.
My idea here is pretty simple, collect the problems I had to solve on my own for future reference. It's for me, not for you, but if it helps you, the better.
Today's problem: upgrading ImageMagic 6.2.8 to 6.7.9-10 on CentOS 5.6
I assume you are root, and that you know what you are doing.
rpm -Uvh http://mirror.i3d.net/pub/fedora-epel/5/x86_64/epel-release-5-4.noarch.rpm
wget ftp://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/linux/CentOS/x86_64/ImageMagick-6.7.9-10.x86_64.rpm
wget ftp://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/linux/CentOS/x86_64/ImageMagick-devel-6.7.9-10.x86_64.rpm
yum remove ImageMagick\* -y
yum install -y --downloadonly --downloaddir=/root/repo/ ImageMagick-6.7.9-10.x86_64.rpm ImageMagick-devel-6.7.9-10.x86_64.rpm
rpm -Uvh ImageMagick-6.7.9-10.x86_64.rpm \
ImageMagick-devel-6.7.9-10.x86_64.rpm \
libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm \
xz-libs-4.999.9-0.3.beta.20091007git.el5.x86_64.rpm \
jasper-libs-1.900.1-14.el5.x86_64.rpm \
jasper-devel-1.900.1-14.el5.x86_64.rpm \
fltk-1.1.9-4.el5.x86_64.rpm \
fftw3-3.2.2-3.el5.x86_64.rpm \
openexr-1.4.0a-1.el5.rf.x86_64.rpm
You might need to change a little here or there, your list of downloaded files might be different, but the basic idea is there.
Cheers.
So instead of reinventing the wheel with every problem or challenge I face, I turn to google to see if someone has already solved it before.
Not every time I find an answer, sometimes there is an answer but it simply doesn't work for me.
My idea here is pretty simple, collect the problems I had to solve on my own for future reference. It's for me, not for you, but if it helps you, the better.
Today's problem: upgrading ImageMagic 6.2.8 to 6.7.9-10 on CentOS 5.6
I assume you are root, and that you know what you are doing.
cd /root/repo
rpm -Uvh http://mirror.i3d.net/pub/fedora-epel/5/x86_64/epel-release-5-4.noarch.rpm
wget ftp://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/linux/CentOS/x86_64/ImageMagick-6.7.9-10.x86_64.rpm
wget ftp://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/linux/CentOS/x86_64/ImageMagick-devel-6.7.9-10.x86_64.rpm
yum remove ImageMagick\* -y
yum install -y --downloadonly --downloaddir=/root/repo/ ImageMagick-6.7.9-10.x86_64.rpm ImageMagick-devel-6.7.9-10.x86_64.rpm
rpm -Uvh ImageMagick-6.7.9-10.x86_64.rpm \
ImageMagick-devel-6.7.9-10.x86_64.rpm \
libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm \
xz-libs-4.999.9-0.3.beta.20091007git.el5.x86_64.rpm \
jasper-libs-1.900.1-14.el5.x86_64.rpm \
jasper-devel-1.900.1-14.el5.x86_64.rpm \
fltk-1.1.9-4.el5.x86_64.rpm \
fftw3-3.2.2-3.el5.x86_64.rpm \
openexr-1.4.0a-1.el5.rf.x86_64.rpm
You might need to change a little here or there, your list of downloaded files might be different, but the basic idea is there.
- If you don't need the '--downloadonly' you can skip the last rpm command.
- For those lacking the '--downloadonly' option, you can have it here:
How do I use yum to download a package without installing it?
Cheers.
Subscribe to:
Posts (Atom)