[CentOS] Alternatives to apache for php based servers: Nginx

Jim Nelson jim at broadtime.com
Fri Mar 11 21:47:32 UTC 2011


On 3/11/2011 4:38 PM, Mark Foster wrote:
> On 03/11/2011 10:54 AM, robert mena wrote:
>> Hi,
>>
>> Anyone here using Nginx as alternative to apache in conjunction to php
>> scripts?
>>
>> Care to share thoughts and caveats?
>>
>> I am reading that it is a good alternative but do not know the real life
>> limitations, diferences to apache, which repo to fetch etc.
>
> First off let me say that nginx is awesome. If you are running a LAMP
> stack and cannot use fastcgi with apache then you can put nginx in front
> of apache to handle static content requests. Result is dramatic decrease
> in memory footprint since you can reduce the number of concurrent apache
> procs. Nginx uses a more efficient request handling so you can serve
> thousands of clients in under 100MB. I think you can also use fastcgi
> with nginx. I haven't done it.
>
> Apache can achieve similar efficiencies with the alternate mpm models
> i.e. not prefork.

We use nginx for caching less-dynamic content as well - all our public pages are served up with the right caching headers and no 
cookies, which allows nginx to serve out of its own cache. We're running mod_perl, but the same principle works for php. This is in 
addition to all the static files (templates, js, css, design images) being served directly by nginx.

It's taken us from falling over on 50 concurrent users a year ago to handling 2000 concurrent users without any slowdown. Once you 
get your public pages cached properly in nginx, apache no longer becomes your bottleneck...

-- 
Jim Nelson
Systems Administrator, Broadtime
(888) 582-3229



More information about the CentOS mailing list