0

Based on my research, I've read that nginx is best and ideal for serving up static files and images. My application depends heavily on uploading of images and rewriting them, then serving them up. Given that I only have one VPS currently, it has been suggested that I use nginx to serve up the images and website, and reverse proxy to Apache (on the same VPS) to rewrite files with image magick and handle the file uploads. Which would be the best solution, Apache, Nginx, or Apache + Nginx? In terms of best solution, I'm looking at minimal average RAM consumption, while maintaining decent load speed of maybe sub 2 seconds?

2
  • Are you actually using Apache to do this dealing-with-files magic, or are you using some kind of language which you'll run inside Apache (e.g. PHP) ?
    – nickgrim
    Jun 21, 2012 at 9:07
  • How much memory does your VPS have? Jun 21, 2012 at 9:22

1 Answer 1

1

You're asking a very broad question and there's no single easy answer to it. However, I think there's increasing confusion about the idea of putting Nginx and Apache on the same server because they offer different performance profiles and working together can 'make things better'.

Running Apache (and I presume, PHP) and Nginx will use more memory than just Apache or just Nginx. Nginx will run PHP code through the use of FastCGI, so Nginx + PHP is more memory efficient than Nginx + Apache + PHP (probably). However, Apache + PHP may be potentially just as memory efficient as Nginx + PHP, depending on how you configure it.

Install Apache only, see how it behaves, and if you have issues, consider moving to Nginx only. If that still doesn't work, then consider hybrid installs.

2
  • Our server just got downsized (again), so I'm ending up with only 1GB RAM or so now. I don't think it will be very feasible to run Nginx + Apache + PHP. From what I've read, apparently resize modules for images run fairly fast for Nginx. However, the majority of my pages will still be dynamic, is that a good enough reason to try apache first? (I'm honestly not fully understanding how the event driven nature of nginx actually affects it's performance with dynamic pages, so forgive me if it's obvious.) Jun 22, 2012 at 18:44
  • 1GB should be plenty for an Apache based website, it all depends on the number of concurrent users. Jun 22, 2012 at 19:05

You must log in to answer this question.

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