The Core

Why We Are Here => Hardware & Technology => Topic started by: Gurtie on February 28, 2013, 11:01:33 AM

Title: domain across two servers?
Post by: Gurtie on February 28, 2013, 11:01:33 AM
not load balancing :)

What I'm looking to do is host one folder of a website on a different CMS on a different server.

For example -

main site - www.mainsite.com

blog on www.mainsite.com/blog

blog needs to run on separate server due to security constraints.

Visitors to the blog need to see the url as www/mainsite.com/blog  and when browsing to see all pages within that domain (eg; www.mainsite.com/blog/page1, www.mainsite.com/blog/page2 etc)


I know there's a way to do this, as I've worked somewhere we did it, and which I have a vague feeling is a reverse proxy or similar but I'm not a techy and I need to explain to someone else how to do it.... can anyone point me at a good explanation?



Title: Re: domain across two servers?
Post by: Torben on February 28, 2013, 11:41:28 AM
> I have a vague feeling is a reverse proxy
You said it

I only have experience with Varnish but I have no experience with what you are trying to accomplish.
Title: Re: domain across two servers?
Post by: jetboy on March 01, 2013, 09:39:54 AM
Different reverse proxies will have different syntax. Here's how to do it in Varnish:

https://www.varnish-cache.org/trac/wiki/VCLExampleXMLHTTPRequest

Top level (assuming than Varnish is running on the same box as your main Apache instance):

1. Varnish listens on port 80 instead of Apache, and processes all http requests.
2. Apache is set to listen on another port, so it doesn't conflict with Varnish.
3. In Varnish, your local Apache instance is setup as your default backend.
4. Setup your blog location as another backend using the syntax from the above wiki link.
5. Job done.

Initial problems with Varnish I had on Ubuntu were:

1. All the entries in Apache's logs now come from 127.0.0.1, not the requesting URL. mod_rpaf on Apache can fix this.
2. If Varnish serves from its cache, the request never even makes it to Apache, so if you use log files, you'll need to use Varnish's as well as Apache's to get a complete picture.
3. Really long URLs and/or lots of cookies can break Varnish with its default settings. I had problems with MyBB. Raising the http_req_size, http_resp_size and sess_workspace parameters fixed this.
Title: Re: domain across two servers?
Post by: Gurtie on March 01, 2013, 12:20:51 PM
Thank you, you're a star!

Lets hope the can use Varnish then and I don't have to translate it to iis or something! Although I *think* you can do that with a standard setting from some of the reading I've been doing....
Title: Re: domain across two servers?
Post by: Gurtie on March 05, 2013, 07:22:16 AM
That seems to have done the trick - certainly moved the techs on from asking me if I took my meds to saying its actually quite simple....

In case anyone else will find it helpful, that then led them, ironically enough, to an SEOMoz infographic

http://www.seomoz.org/blog/what-is-a-reverse-proxy-and-how-can-it-help-my-seo

Title: Re: domain across two servers?
Post by: Rooftop on March 05, 2013, 09:13:44 AM
Doing link clean-up and now linking to seomoz infographics?  I've got a t-shirt here I should send you Gurtie.
Title: Re: domain across two servers?
Post by: Torben on March 05, 2013, 01:03:28 PM
>  All the entries in Apache's logs now come from 127.0.0.1, not the requesting URL. mod_rpaf on Apache can fix this.

127.0.0.1 in my logs has been annoying. On the other hand mod_rpaf was last updated in 2008 so that is not going any where near my server.

I found this little Varnish trick: http://www.gossamer-threads.com/lists/varnish/misc/15237. I haven't implemented it yet but I plan to and will let you know how it goes.
Title: Re: domain across two servers?
Post by: Gurtie on March 06, 2013, 01:33:39 PM
Quote from: Rooftop on March 05, 2013, 09:13:44 AM
Doing link clean-up and now linking to seomoz infographics?  I've got a t-shirt here I should send you Gurtie.

I know. I need a smokey bar and a good dose of spam.