Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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?
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?
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..
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.
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.
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?
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?
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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.