I have a Xen virtual private server (VPS) running Ubuntu 8.10, with 128M RAM.

I've found several "how to optimize Apache and MySQL for low-memory VPS" pages via Google, but they provide contradictory information. So I'm asking Server Fault: how does one optimize Apache and MySQL for a low-memory VPS configuration?

A couple of people have suggested using nginx instead of Apache. I'll look into that, but I'd prefer to stick with Apache if possible, just to avoid having to learn all about configuring application stacks on top of an unfamiliar (to me) web server.

3 Answers 3


Nginx is great, but if you want to stick with Apache, it's possible to slim it down quite a bit from the default settings:

  • Use the worker MPM rather than prefork (with worker MPM Apache no longer has a "process per connection" model).
  • Look at all the shared modules you're loading, get rid of any that you don't need.
  • Avoid embedding application servers inside Apache (i.e. mod_python, mod_php, etc) if you can avoid it. Instead, run application servers in a separate process and have Apache proxy to them (i.e. for Python code use mod_wsgi in daemon mode). This way your Apache threads that are simply serving static content won't be unnecessarily bloated.
  • In your Apache config, reduce the StartServers, MaxClients, MinSpareThreads, and MaxSpareThreads settings. Depending on your expected load you can sometimes reduce them by a factor of five or more from the default settings.

If you have memory constraints, I would recommend using nginx as an alternative if at all possible. It consumes much less memory than Apache and depending on your needs could be all that you need.

As a bonus, nginx tends to be significantly faster than Apache. =)


Ditch apache, it's process per connection model will not play will with your low memory VPS.

I suggest nginx as a replacement.

  • 4
    This is only an issue for 1.3. apache 2.x allows plugable process modules including MPM which runs many threads in a small number of processes. All tunable to taste
    – Vagnerr
    Apr 30, 2009 at 14:09
  • Yes, but nginx will still be a smaller process May 10, 2009 at 8:35
  • 2
    Yes, but that's not what you said
    – Domster
    Jun 11, 2009 at 1:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .