0

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.

Thanks

womble
  • 95,029
  • 29
  • 173
  • 228
mattbasta
  • 631
  • 1
  • 8
  • 17

2 Answers2

5

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.

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
  • "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 08 '09 at 04: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
-1

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.

Jon Moore
  • 156
  • 1
  • 6
  • 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 08 '09 at 04:07