Dynadot โ€” .com Registration $8.99

Apache + Lighttpd

Spaceship Spaceship
Watch
Impact
328
I'm using Apache as the "main" server - PHP / SQL / etc etc. However, I want to set up lighttpd to serve the 'static' files (image / css / js files). Anyone happen to have any ideas? :)

EDIT:

Running Apache 2.2.6 w/PHP 5.2.5RC2 on CentOS 4.4
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
I'm assuming you're wanting to setup a lighttpd server on a different physical server, so you'd probably just want something reallly simple (no cpanel or anything) and then just install lighttpd & an ftp server yourself, that way there would be minimal load on the server. Also specs probably wouldn't need to be very high, since there wouldn't need to be much processing going on.

Or if you were wanting to set it up on the same physical server it'd have to run on a different port, say 8080, and could be installed side by side with apache, just a little more configuration needed. Although with that solution you probably wouldn't see that much of a performance advantage, and some filtering services may block servers running on ports other than 80 (I know my school used to, college does).
 
0
•••
Out of interest why do you want to do this? You could set up lighttpd to listen on a different port and use for example www2.domain.com/location/of/image/image.gif as the address but you would have the overhead of running 2 webservers.
 
0
•••
peter@flexiwebhost said:
Out of interest why do you want to do this? You could set up lighttpd to listen on a different port and use for example www2.domain.com/location/of/image/image.gif as the address but you would have the overhead of running 2 webservers.
Most of my server's load is from static files. I've already got a few things in place to help reduce it, but I've heard lighttpd can work wonders. (and as far as overhead, from what I could understand, lighttpd virtually has none)
 
0
•••
It will have an overhead even if very little. Running 2 webservers from the same system is not necessarily the best solution. I personally would concentrate on lowering the load mySQL (including restructuring your tables if needed) and apache (such as the number of connections allowed etc) have first and then decide if more action is needed.

You should also profile your applications to see what (if any) are causing bottle necks. You can use something like Zend Platform that can break down your application to each function call and tell you how much each is taking. You used to be able to get a free developer license, I assume this is still the case.

Also consider using something like Zend optimizer. This does not only work for files encoded using Zend Guard, it also speeds up normal code.
 
0
•••
Have you considered hosting your static files on another account, such as a shared web host? That way your server only does the dynamic stuff, and all static files are offloaded elsewhere.
 
0
•••
I'd have to say you're not going to garner much additional speed out of this type of configuration. The solution to your question would be to run them on different ports and pass the connections over to the Lighttpd server, but for what you're saying above, there's not really going to be a difference in performance.
 
0
•••
ok i have done this a few times,
you can use what ever httpd server you wish (i generaly use apache cause i use it else where), the best way to do it i have found, is to setup your httpd with only the require modules to run (ie no perl, php etc etc, just basicly the ability to send files), having stuff like php enabled does slow down even if it's not used.

second you'll make to make sure that keep alive is turned on.

ok, for your application, i would suggest you add in something like define('STATIC_URL',http://static.domain.com);
and link anything that is static like <img src=\"".STATIC_URL."\/images/image01.gif">

that way you'll be able to change it on the fly, and it means you can do a gradual change over time to all your files.
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back