Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Apache or NGINX for PHP?


i have searched for this around the web and i can't find the right answer for my question.

basically i want to know if i can get better performance with nginx than with apache (in php apps), and i'm not involving static content (where i know nginx is better).

the sites are a widely collection of scripts with a lot of variables, using old not OOP oriented code and new websites using classes and smarty. the sites are very dynamic, changes parts in each request.

i want to avoid suing nginx for static content and apache for php, so for that i;m asking, if it worth the transition in performance terms.

my main confusion comes where i have seen benchmarks using wordpress and wp-supercache plugin, that could make it better for nginx than a custom sites with the features i already described. i have seen other benchmarks that just not show a big difference between them (around 5%)

thanks in advance for any help :D

Regards, Shadow.

share|improve this question

marked as duplicate by Warner, mrdenny Jun 19 '10 at 23:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

See also: This topic is well covered on Serverfault as asked. – Warner Jun 19 '10 at 22:21
thanks, that's what i was looking :D finally seems to be that nginx + apache for dynamic contents is the best option :D thanks to all – shadow_of__soul Jun 19 '10 at 23:22
it'd be nice if you put an exact reference not simply nginx apache, if you hit that URL, MANY irellevent results are returned, this was a fairly specific question and I've had to scan through nearly a hundred before I found a result that seemed close to this question... – RandomNickName42 Apr 25 '11 at 22:41
up vote 1 down vote accepted

What do you mean by 'performance'? Does it mean maximum throughput on a very busy server or does it mean fast pageloads for individual pages?

Apache is rarely the limiting factor (some settings may improve performance 'tough). Usually the real load lies with php or mysql, and then usually badly constructed queries or useless work.

Where nginx shines compared to apache 1 and 2 is in handling many concurrent connections (idle or busy). It also makes server paradigms possible that are not available on other webservers. It does not magically improve the performance of PHP/MySQL.

Stopgap measures probably more worth your time than nginx are a php opcode cacher (apc) and the mysql query cache. Other than that I'd start profiling and fixing the code.

For faster pageloads you will have most benefit from modifying the way the site works, see for example the yahoo performance blog.

share|improve this answer
right now both things are important,why there is 2 different servers where need to be migrated. one of them as i said before, have that type of pages, old coded and would be great to improve the load time and there are some days on the year where is get very busy.always apache handle it perfectly, there is no something that need to be fixed but just wondering if nginx could improve in any aspect – shadow_of__soul Jun 19 '10 at 22:03
in other hand, i have a app as facebook very optimized that run a REST server and a frontend with smarty. that is something that need to handle from 200 to 1000 user at the same time, could ngnix prevent a problem? thanks for any help that could guide me in this matter :D – shadow_of__soul Jun 19 '10 at 22:04
The old code server would probably benefit from a php opcode cacher ("accelerator") and mysql query cache - and a code rewrite. In this case with the info you've currently provided I'd not invest in migration to nginx on that old code server. The rest server would be an interesting case to optimize; it depends on how your app behaves. A well-configured nginx should almost never perform worse than apache. – Joris Jun 20 '10 at 5:14

Considering the breadth of applications of PHP, as well as any other web-serving scripting language, each website can behave very different. I strongly recommend creating two different servers and comparing their stats for your own use. As different websites can have different uses for their tech.

share|improve this answer
sorry but i don't have the time now to make benchmarks, for that i'm looking for help – shadow_of__soul Jun 19 '10 at 22:05

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