possible to have 1 html server and 1 php server for 1 site?
Moderator: General Moderators
possible to have 1 html server and 1 php server for 1 site?
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.
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.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: possible to have 1 html server and 1 php server for 1 site?
You could do that by rewriting URLs. You would set the server based on the file extension.
(#10850)
- hannnndy
- Forum Contributor
- Posts: 131
- Joined: Sat Jan 12, 2008 2:09 am
- Location: Iran>Tehran
- Contact:
Re: possible to have 1 html server and 1 php server for 1 site?
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
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?
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)
@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?
search for url rewriting and reverse proxy
Re: possible to have 1 html server and 1 php server for 1 site?
i don't think url rewriting has any useful meaning in this case..Weirdan wrote:search for url rewriting and reverse proxy
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?
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?
i can hardly imagine that something like that could be a performance gain.. i think it's more a performance lost than a gain.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'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.
Last edited by markg85 on Sat Jan 26, 2008 7:35 pm, edited 1 time in total.
Re: possible to have 1 html server and 1 php server for 1 site?
Why would you need this?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
There are 10 types of people in this world, those who understand binary and those who don't
Re: possible to have 1 html server and 1 php server for 1 site?
Well.. quote of myself:VladSun wrote: Why would you need this?
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.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.
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!).
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: possible to have 1 html server and 1 php server for 1 site?
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: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.
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"/>(#10850)
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: possible to have 1 html server and 1 php server for 1 site?
Amen to keeping it simplearborint wrote: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: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.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?
So, what you will need is a load balancing.markg85 wrote:But where this can be needed is when you have a very busy site (lets take digg.com as an example).
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
There are 10 types of people in this world, those who understand binary and those who don't