Use Apache for dynamic, nginx for static, seperate platform?
I setup Linux-Apache-MySQL-Rails for my rails app.
Then, I want to use nginx to serve static assets, because I don't want to load Apache too much. I heard this setup could be useful.
However, for performance sake, should I install nginx on the same server as Apache, or just create another disk image to make another Linux-nginx platform?
In result, I will have:
1. Ubuntu-Apache-MySQL-Rails to run my app on abc.com
2. Ubuntu-nginx to run my static assets on xyz.com
Will this be a better arrangement?
6 Replies
anyway, no need for a separate linode, nginx only uses a few megs of memory.
you'll either want to use a separate domain and ip for static content, or move apache to port 81 and nginx on 80 and set up a proxy config. it's well documented.
So there shouldn't be any performance difference having nginx run seperately on another linode, or run on top of Apache?
@khuenping:
Apache performs better for dynamic content.
Benchmarks seem to show this (while lighttpd is the opposite, faster doing PHP than Apache), but CPU load on a Linode is rarely the bottleneck. Is it worth running two different web servers when you could just run everything under a single web server, at a possible small performance hit?