Use Apache for dynamic, nginx for static, seperate platform?

Hi guys.

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

when you say disk image, it sounds like you want to run two at the same time on the same linode, you can't do that.

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.

Sorry, not disk image, just different linodes.

So there shouldn't be any performance difference having nginx run seperately on another linode, or run on top of Apache?

Why mix and match? Why not use nginx for dynamic content too?

Apache performs better for dynamic content.

@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?

For a while I ran nginx as a static file server and reverse proxy to Apache (modwsgi and modphp). I have since removed Apache from the equation and just run nginx with php-fpm and uwsgi on most boxes.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct