How To Install Varnish properly - Freebsd

Would you like to see Varnish added to Directadmin


  • Total voters
    18

DA-Rff

Verified User
Joined
Dec 4, 2006
Messages
119
How to install Varnish properly on a freebsd DA machine.

Please help me out here, as I have played around quite a bit, but am left in the dark how to get this working.

I am on a freebsd 7.2 64 bit DA machine and do NOT want to change DA settings, cause that would ruin my upgrade path with DA etc.

Therefore here is how I think it has to be done:
- leave DA stuff alone
- use Varnish in front of apache
- apache stays on port 80
- traffic from port 80 is redirected through firewall to varnis port, varnish internally uses the port 80 to backend non cached stuff to apache

BUT...

Stating the above was the easy part, now the question comes How to get this to work on a freebsd machine.

I have not been able to get this to work, so if anyone is game to try it out and post the how to here, all of us freebsd happy da-users would be highly indebted!

Thanks!
 
Why are you asking on directadmin about varnish? It has nothing to do with varnish and this is not their support forum. And why would you want to use it anyways? It has no improvements at all.
 
Why are you asking on directadmin about varnish? It has nothing to do with varnish and this is not their support forum. And why would you want to use it anyways? It has no improvements at all.

Hi scsi,

thanks for stopping by and asking, I thought it would be clear why I asked this, but apparently not, let me explain:
DA uses port 80 for apache and all sites placed on the server use port 80.

Varnish wants to listen to port 80 first, and then passes non cached requests on to the new port (par example 8080). But for that httpd.conf and the individual sites confs must be adapted to this, and this is where the trouble lies.

I am very happy with DA and want DA to keep things organised on my server, yet I want speed improvements on my sites, and varnish just looks very good. But varnish has implications for the organisation of sites and other things on the server.

And that is why I asked in the DA forum.

Hope that explains it better! And definitely hoping for someone to come by with a solution.
 
Thread moved. This is not a how-to. A how-to is a set of instructions.
Jeff
 
I never heard of anyone on here saying they use it.

But you should check out http://www.unixy.net/varnish/

They have made an addon that works with directadmin.

I am sure with your monthly subscription they would help you set it up on your server.

If not I know there are tons of guides all over the internet to setting up varnish with apache.

Then you just need to change which port your sites listen on.

There are templates in /usr/local/directadmin/data/templates which control how the virtual hosts are written out. You just need to copy them to the custom folder to make changes and then you can issue a command to rewrite all virtual host configs.

If you are unfamiliar with setting it up then I suggest you either use that plugin or see if you can hire someone to do the work. You probably would have better luck finding someone on webhostingtalk.com than here that knows how to configure everything properly.
 
I don't know about FreeBSD but in CentOS, you can set Varnish to use any other port, then, use iptable to forward port 80 to that port, then, Varnish will connect to Apache port 80 internally. It will works fine. I just did it a week ago. The only problem I can think of right now is that can VCL (Varnish rule) be set to specific website or not? Without that ability, you have to specify rules for each website when you add a new one into DA. Look at the instruction how to do that in NginX proxy server, I use the same method.

Or you may need to modify Apache config to change port but I don't know much about it and don't want to do that because then, you will have to change it everytime you upgrade Apache or change some config in DA. (Unless, it's global change, so you can leave changed file in custom folder.)
 
Last edited:
@DA-Rff

Bind Apache to 127.0.0.1 and you can use Varnish on <public IPs>:80

thanks for that, could you tell me if the following is what is needed then?

- cd /usr/ports/www/varnish && make install clean
- pkg_add -r varnish
- change httpd.conf==> Listen 127.0.0.1:80

Do I need to change anything else, like the varnish vcl file?

thanks
 
Back
Top