Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 '12 at 9:07
    
How much memory does your VPS have? –  EightBitTony Jun 21 '12 at 9:22

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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.) –  user1032393 Jun 22 '12 at 18:44
    
1GB should be plenty for an Apache based website, it all depends on the number of concurrent users. –  EightBitTony Jun 22 '12 at 19:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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