Page 1 of 1

possible to have 1 html server and 1 php server for 1 site?

Posted: Fri Jan 25, 2008 8:05 pm
by markg85
Hey,

I was just wondering if it is possible to have basically 2 servers serving 1 site?
more detailed example:

server_1 html only
server_2 php only

than the site http://www.example.com
now the idea is that static html pages are being served with server_1 and php pages are being served with server_2.
so http://www.example.com/index.html == from server_1
and http://www.example.com/index.php == from server_2

I'm just searching for information on this out of curiosity and have no special desires for webserver software. as long as it runs on linux and php can run on the webserver.

Thanx,
Mark.

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Fri Jan 25, 2008 10:37 pm
by Christopher
You could do that by rewriting URLs. You would set the server based on the file extension.

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 12:21 am
by hannnndy
you mean that you want to put the index.html on one server for example in Canada and the php one in us

or you mean that you want to have both html and php extension as the index extention

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 6:50 am
by markg85
I mean that 1 server might for example be in the us and serve the .html pages and one somewhere else that serves the .php pages. (not that this would be smart for a performance viewpoint ;))

@arborint
How can i set a server for a file extension? is there a howto for it somewhere? (didn't found one yet)

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 9:12 am
by Weirdan
search for url rewriting and reverse proxy

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 11:40 am
by markg85
Weirdan wrote:search for url rewriting and reverse proxy
i don't think url rewriting has any useful meaning in this case..
If you think otherwise could you explain it?

and i'm still lokking for more information to set a server on the .php extension and on the .html extension..
looking into reverse proxy now.

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 11:55 am
by Weirdan
Url rewriting can be used to redirect request to another host, so it can be used for your problem:

Code: Select all

 
RewriteEngine On
RewriteRule  (.+)\.html$  http://html.yourdomain.com/~$1.html  [R,L]
 

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 12:06 pm
by markg85
Weirdan wrote:Url rewriting can be used to redirect request to another host, so it can be used for your problem:

Code: Select all

 
RewriteEngine On
RewriteRule  (.+)\.html$  http://html.yourdomain.com/~$1.html  [R,L]
 
i can hardly imagine that something like that could be a performance gain.. i think it's more a performance lost than a gain.
I'm currently looking at Squid and this: http://www.serverwatch.com/tutorials/ar ... hp/3290851
That is looking promising.

edit:://
now that i think of it again.. that might just be the quickest way to get it done.

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 12:16 pm
by VladSun
markg85 wrote:Hey,

I was just wondering if it is possible to have basically 2 servers serving 1 site?
more detailed example:

server_1 html only
server_2 php only
Why would you need this?

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 7:33 pm
by markg85
VladSun wrote: Why would you need this?
Well.. quote of myself:
I'm just searching for information on this out of curiosity and have no special desires for webserver software. as long as it runs on linux and php can run on the webserver.
But where this can be needed is when you have a very busy site (lets take digg.com as an example). than you want to have everything tuned to the limits and static pages don't need to be served by a server that is also serving php pages. Also images/videos/files etc don't need to get on either the html or php server but on a server that simply sends the file.

And again. i just want to know this stuff out of curiosity. (of cause i hope to make a site once where i need to apply this technique to.. that means that i have a very successful site!).

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 7:44 pm
by Christopher
markg85 wrote:But where this can be needed is when you have a very busy site (lets take digg.com as an example). than you want to have everything tuned to the limits and static pages don't need to be served by a server that is also serving php pages. Also images/videos/files etc don't need to get on either the html or php server but on a server that simply sends the file.
Wouldn't it be much simpler, and require no overhead, to just specify the different servers in the URL. I do this on several sites where the page are on one server, the image are on another server, and videos on a third. I would just make the URLs like:

Code: Select all

<a href="http://www.myserver.com/page.php">PHP Page</a>
<a href="http://static.myserver.com/page.html">HTML Page</a>
<img src="http://image.myserver.com/someimage.jpg"/>

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sat Jan 26, 2008 8:48 pm
by Chris Corbyn
arborint wrote:
markg85 wrote:But where this can be needed is when you have a very busy site (lets take digg.com as an example). than you want to have everything tuned to the limits and static pages don't need to be served by a server that is also serving php pages. Also images/videos/files etc don't need to get on either the html or php server but on a server that simply sends the file.
Wouldn't it be much simpler, and require no overhead, to just specify the different servers in the URL. I do this on several sites where the page are on one server, the image are on another server, and videos on a third. I would just make the URLs like:

Code: Select all

<a href="http://www.myserver.com/page.php">PHP Page</a>
<a href="http://static.myserver.com/page.html">HTML Page</a>
<img src="http://image.myserver.com/someimage.jpg"/>
Amen to keeping it simple :)

Re: possible to have 1 html server and 1 php server for 1 site?

Posted: Sun Jan 27, 2008 2:54 am
by VladSun
markg85 wrote:But where this can be needed is when you have a very busy site (lets take digg.com as an example).
So, what you will need is a load balancing.
The easiest way would be round robin DNS - multiple IPs for a domain. This way the load balancing is done by the DNS, not by the "heavily loaded" www servers ;)