LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-04-2007, 10:01 PM   #1
matsko
Member
 
Registered: Dec 2005
Posts: 51

Rep: Reputation: Disabled
Double Server Setup


Does anyone here know how to setup a double server daemon setup? One that has two daemon programs setup on one server (one acts as a static server and the other acts as a dynamic server).

How does the server know which connections to send to the dynamic server and which ones to sent to the static server?
 
Old 08-05-2007, 04:32 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Double what server? There's some info missing for a sensible
response ...



Cheers,
Tink
 
Old 08-05-2007, 04:15 PM   #3
matsko
Member
 
Registered: Dec 2005
Posts: 51

Original Poster
Rep: Reputation: Disabled
OK.

One machine is used and on that machine there is apache (with php) and then there is another daemon (lighthttp) which has only static files.

This is what I need help with:

When a page is requested from the server (http://mydomain.com/index.php) the request is automatically sent to apache. But how would I get it to work for the static server? I will be using the same domain, but I want all the static files (js, css, swf, images, etc...) to be handled by lighthttp.

Do I setup a particular port that the lighthttp server will listen on? And then setup each request to access that port?

<img src="graphics/image.gif:800" />

Would this work? How do I set it up?
 
Old 08-05-2007, 08:47 PM   #4
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
You could do that, if you really wanted to. I'd recommend port 8080, which is a very common alternate port for HTTP. I would think it easier just to use only Apache though. Why do you need to use both?
 
Old 08-05-2007, 11:04 PM   #5
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
And either way Port 8080 is NOT a standard port so your website would be broken for users on my corporate network..

imho using ports other than 80 or 443 for a website is bad practice, if you want people to be able to actually access and use your site, but hey silly me, I do ingress and egress filtering on my networks.

Why not just let Apache handle the static content as well as the dynamic content or use a seperate machine to host the static and dynamic content.. seems very popular these days to do that..

Server 1
www.mysite.com

Server 2
images.mysite.com

Server 3
static.mysite.com

At least with this approach while heavy on hardware is using all standard ports. if your site is getting enough traffic to force you to actually split that content then using multiple servers to split the load is not unreasonable.

Last edited by farslayer; 08-05-2007 at 11:07 PM.
 
Old 08-05-2007, 11:42 PM   #6
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
Quote:
Originally Posted by farslayer
And either way Port 8080 is NOT a standard port so your website would be broken for users on my corporate network..
Port 8080 IS a standard port. IANA, who assign port numbers, designates TCP 8080 as:
Code:
http-alt	8080/tcp    HTTP Alternate (see port 80)
It is the most common alternate port used for HTTP.
Quote:
imho using ports other than 80 or 443 for a website is bad practice, if you want people to be able to actually access and use your site, but hey silly me, I do ingress and egress filtering on my networks.
There will be a few silly sysadmins who don't realize that they are breaking websites by blocking port 8080. There are very few sites that don't use port 80 exclusively. A majority of those who don't, use port 8080.

Nevertheless, the point is valid. There will be a few poor souls who won't be able to access that content.
Quote:
Why not just let Apache handle the static content as well as the dynamic content or use a seperate machine to host the static and dynamic content.. seems very popular these days to do that..
...
At least with this approach while heavy on hardware is using all standard ports. if your site is getting enough traffic to force you to actually split that content then using multiple servers to split the load is not unreasonable.
I agree. I'd just put it all in Apache. If you really must have separate file trees, then you could look into setting up virtual hosts in apache (though I see no reason for the need).

Unless you can give us a good reason why not, I suggest just putting everything in apache.
 
Old 08-06-2007, 01:43 AM   #7
matsko
Member
 
Registered: Dec 2005
Posts: 51

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by farslayer
Why not just let Apache handle the static content as well as the dynamic content or use a seperate machine to host the static and dynamic content.. seems very popular these days to do that..
Lets say you have a server that handles only static requests; Therefore 100% of your content is static. That means that each process will use a relatively small amount of RAM per request (around 2-3 megs on average, but that depends on the size of the files being requested).

That's all good and dandy, but lets say that your server now is a configured with PHP and thus is a dynamic server. Each request now may use from 3-20megs per request (depending on your most heavy dynamic page). But your website will still include static content (images, css files, js files, swf files, etc...) right? Obviously, but the problem now is that the http requests for those files will end up having the same amount of RAM set aside for them as the most heavy php script. Apache's memory management grows to accommodate what it's server and never decreases.

So in the end too much RAM is being used up to accommodate a dynamic website. THIS is why I wan't to setup a static-only server which will provide all the static files, but will still reside on the same server as the dynamic one.

This memory issue may be different on Apache2+.

----

I didn't mention that my website is going to use a reverseproxy. Basically all the requests that come are forwarded, once all the http connectivity is complete, to the main dynamic server. So if I setup the configuration in the reverse proxy server's httpd.conf file to redirect all the requests from static.mywebsite.com to static.mywebsite.com:8080 and then have the static server listen on that port, would this work?

Last edited by matsko; 08-06-2007 at 01:47 AM.
 
Old 08-06-2007, 02:08 AM   #8
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
Sounds ridiculous (which doesn't make it false). Why not use and test apache2? Also, what are your memory limits? (Can you not install more?)
 
Old 08-06-2007, 11:26 AM   #9
matsko
Member
 
Registered: Dec 2005
Posts: 51

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by gd2shoe
Sounds ridiculous (which doesn't make it false). Why not use and test apache2? Also, what are your memory limits? (Can you not install more?)
Why would you spend more money when you can simply spend more time learning this and then setting up a workaround solution.

Read this. It is very helpful:
http://www.crucialp.com/resources/tu...pache-load.php
 
Old 08-06-2007, 06:11 PM   #10
matsko
Member
 
Registered: Dec 2005
Posts: 51

Original Poster
Rep: Reputation: Disabled
OK here's how I am going to setup the static and the dynamic server. There will be two IP addresses setup for the server machine. Then Apache will listen on one IP address and lighthttpd will listen on another. I will use the main domain of my website to target to the dynamic server and then a static subdomain will target the request to the static server.

Apache Configuration:

listen: 12.34.56.78:80 //Dynamic IP

LightHTTPD Configuration:

Listen: 87.65.43.21:80 //Static IP

Then in the DNS settings, I will have static.mydomain.com resolve to 87.65.43.21.

I have a switch where my server machine is connected to. How do I setup the server machine to handle two ip addresses?
 
Old 08-06-2007, 07:20 PM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by matsko
Is it?

I don't think that the guy who wrote that has a clue
as to how to interpret tops output ...

Just because my "VIRT" size for the apache processes
is 52M doesn't mean that they're using that much RAM
each. It's their "potentially used shared libraries if
actually dragged into RAM". The value that matters is
RES - SHR (and take that with a grain of salt, too).




Cheers,
Tink
 
Old 08-06-2007, 08:26 PM   #12
gd2shoe
Member
 
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835

Rep: Reputation: 49
I've never done it personally, but you would create "virtual adapters" or "alias". The file that the settings belong in varies based on distro. On Debian, I believe the settings go in /etc/networking/interfaces. You will want to create eth0:0 and eth0:1, etc (each has it's own IP address, but all go through the eth0 adapter). You should be able to find plenty of examples on the web.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Double Port redirect on web server like myurl.com:8000:8081 bruce1271 Linux - General 2 03-07-2007 08:12 AM
Double the desktop, not double the fun! bizshop SUSE / openSUSE 3 08-26-2005 12:22 PM
Setup a linux server, DNS, WEB, FTP, and Mail Server Help watermelon_lee Linux - Networking 1 08-26-2003 03:09 AM
Setup linux-apache server to access documents on NT server josephswagner Linux - Software 11 04-11-2003 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration