Hosting multiple virtualhosts in apache2

David Murphy david at firechaser.com
Mon Mar 7 09:33:25 CET 2011


Hi Brian

Unless the second site is doing something unusual, I don't think you need
worry about having its virtualhost listen on another port. Just have all of
your websites configured to run on port 8080 and then any site-specific
rules (such as which pages/assets can be cached) can be added to the VCL
file.

We have a server that has a Varnish front end and about 6 or 7 very
different websites running under Apache (port 8080) on the backend, all with
their own unique domain names. For the most part all sites share the same
rules e.g. such as 'always cache images' and 'never cache .php' but a couple
of sites need to be treated different e.g. 'do not cache anything in the
/blah directory of site abc' and we add that rule to the VCL file.

Best, David



On Sat, Mar 5, 2011 at 3:33 AM, Brian Neltner <neltnerb at mit.edu> wrote:

> Dear Varnish,
>
> I'll preface this with saying that I am not an IT person, and so
> although I think I sort of get the gist of how this all works, if I
> don't have fairly explicit instructions on how things work I get very
> confused.
>
> That said, I have a slicehost server hosting http://saikoled.com which
> has varnish as a frontend. Varnish listens on port 80, and apache2
> listens on port 8080 for ServerName www.saikoled.com with ServerAliases
> for saikoled.com, saikoled.net, and www.saikoled.net.
>
> What I want to do is have the slice host a different website from the
> same IP address, microreactorsolutions.com.
>
> I *think* that I know how to set apache2 up with a virtualhost for this,
> and my thought was to tell it that the virtualhost should listen on port
> 8079 instead of 8080 (although maybe this isn't necessary).
>
> To try to do this, I looked at the documentation for Advanced Backend
> Documentation here
> (
> http://www.varnish-cache.org/docs/2.1/tutorial/advanced_backend_servers.html
> ).
>
> However, the application they're looking at here is sufficiently
> different from what I want to do (although frustratingly close), that I
> can't tell what to do. It seems that this is setup to have a
> subdirectory that matches the regexp "^/java/" go to the other port on
> the backend, which is all well and good, but this doesn't seem to be
> something that is likely to work with a totally different ServerName
> (after all, the ^ suggests pretty strongly that the matching doesn't
> begin until after the ServerName).
>
> I also saw in the "Health Checks" some stuff that looked like it did in
> fact do some stuff with actual ServerNames, but I really don't get how
> to tell Varnish where to pull requests on port 80 from which as far as I
> can see is done with regexps that don't handle what I'm looking for.
>
> Sorry if this is covered somewhere more obscure in the manual, but as I
> said, I'm really not particularly good with computers despite the mit
> email address (I do chemistry...), and trying to work through this
> entire manual in detail is going to drive me crazy.
>
> Best,
> Brian Neltner
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110307/ba16a6f8/attachment-0003.html>


More information about the varnish-misc mailing list