I've been thinking about running lighttpd for static content, but I'd rather not throw down the couple extra bucks to run the second box. Is it possible (and this is me going out on a limb) to run Apache on port 80 and lighttpd on another port (say, 81)? I know it would be better to just put it on another box, but I'm looking to do this on the cheap if possible.



Changing the port that lighttpd listens on is pretty staightforward. Just change the "server.port" directive in "lighttpd.conf" (or wherever your OS decides to put the config for lighttpd).

Are you planning on adding a ":81" to all the URLs that refer to the lighttpd content?

If not, you should think about running lighttpd on port 80, moving Apache to another port, and proxying access to Apache through lighttpd. As has been discused on Server Fault already, running lighttpd as the proxy is preferred since it's "lighter weight" than Apache.

Of course, lighttpd isn't the only show in town. Some comparison between lighttpd, apache, and nginx has been the topic of conversation over at Stack Overflow. I don't use lighttpd and I don't know if the memory leak issues that I've seen mentioned in a couple of places have been addressed or not.

  • "Are you planning on adding a ":81" to all the URLs" ...yeah, that's what I was figuring for static content. I can't imagine that there's any reason I couldn't do it, but I'd rather ask then experiment and waste a day. – mattbasta Nov 8 '09 at 4:10
  • I've been running Lighty for some time and have yet to encounter the memory leak problem. Supposedly, it still exists, but I can only assume it only occurs in certain instances/configurations which haven't been identified yet. – Garrett Albright Nov 10 '09 at 17:47

Why do you want to do this? Having a separate server to handle static content, isn't necessarily a bad idea. However, running lighttpd (or anything else) and apache on the same machine seem to be a bit misguided.

If you're having proformance issues, I'd find out where they are coming from. If it's anything like disk IO, memory issues, network issues, etc. running lighttpd isn't going to help. All those issues will still be there (assuming it's ran on the same machine).

If you're problem is long running scripts or similar, maybe it will help a tad bit, but I don't think it would be worth the effort.

In my opinion, if your site needs static content served different then dynamic, then you probably should move that content to another server. It's probably time to start looking at a bigger hosting package.

That being said, I would suggest storing the static content on another disk (on another controller if possible) just to mitigate the lighttpd and apache processes from fighting for disk access. Also, if you have the ram, it's possible to put that static content into a ramdisk for even faster access. Though at somepoint simple network bandwidth limitations are going to come into play.

  • 2
    Obviously you've never actually done this, because it does make a significant difference to system load and throughput to serve static content with something like lighttpd or nginx. Apache is relatively bad at serving static content, especially when it's also serving dynamic content out of the same server. – womble Nov 8 '09 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.