[{"data":1,"prerenderedAt":286},["ShallowReactive",2],{"art-nginx-vs-apache-php-2026-en":3},{"id":4,"title":5,"author":6,"body":7,"date":272,"description":273,"extension":274,"image":275,"meta":276,"navigation":277,"path":278,"seo":279,"stem":280,"tags":281,"__hash__":285},"blogEn\u002Fen\u002Fblog\u002Fnginx-vs-apache-php-2026.md","Nginx vs Apache for PHP in 2026: which one to pick and why","Paco Cubel",{"type":8,"value":9,"toc":260},"minimark",[10,15,24,27,31,52,55,59,69,76,80,110,114,146,150,157,160,186,189,193,196,234,238,244,251],[11,12,14],"h2",{"id":13},"the-debate-is-still-alive","The debate is still alive",[16,17,18,19,23],"p",{},"\"What’s better for PHP, Nginx or Apache?\" is a question we’ve been answering for years in consulting. The honest answer is: ",[20,21,22],"strong",{},"it depends",". And the right answer in 2026 has changed compared to 2018.",[16,25,26],{},"Let’s break it down.",[11,28,30],{"id":29},"how-they-work-short-version","How they work (short version)",[32,33,34,46],"ul",{},[35,36,37,40,41,45],"li",{},[20,38,39],{},"Apache"," processes each request in a dedicated process or thread. With ",[42,43,44],"code",{},"mod_php"," it runs PHP directly, which is convenient but consumes a lot of memory.",[35,47,48,51],{},[20,49,50],{},"Nginx"," is asynchronous and offloads PHP to a separate process (PHP-FPM). This lets it serve thousands of concurrent requests with very little memory.",[16,53,54],{},"Under heavy static traffic, Nginx wins. Under very high concurrency with PHP, Nginx + PHP-FPM also wins, generally by a comfortable margin.",[11,56,58],{"id":57},"what-changed-in-2026","What changed in 2026",[16,60,61,62,65,66,68],{},"Apache has matured. ",[20,63,64],{},"Apache event MPM + PHP-FPM"," performs much better than the old ",[42,67,44],{},". The gap with Nginx isn’t enormous any more in many cases, especially with medium workloads.",[16,70,71,72,75],{},"The choice today isn’t purely about performance, it’s about ",[20,73,74],{},"operations",".",[11,77,79],{"id":78},"when-to-pick-apache","When to pick Apache",[32,81,82,92,98,104],{},[35,83,84,91],{},[20,85,86,87,90],{},"Shared hosting or sites with many ",[42,88,89],{},".htaccess"," files",": Apache handles them out of the box, no need to touch global config.",[35,93,94,97],{},[20,95,96],{},"Older CMSes"," that come tuned for Apache (some WordPress plugins, certain PrestaShops).",[35,99,100,103],{},[20,101,102],{},"Team that already knows Apache",": switching to Nginx because it’s trendy and then not knowing how to operate the server is worse than running Apache properly.",[35,105,106,109],{},[20,107,108],{},"Complex existing mod_rewrite rules"," that would take days to rewrite in Nginx.",[11,111,113],{"id":112},"when-to-pick-nginx","When to pick Nginx",[32,115,116,122,128,134,140],{},[35,117,118,121],{},[20,119,120],{},"Heavy concurrent traffic",": sites with high traffic peaks, especially if they serve a lot of static content alongside PHP.",[35,123,124,127],{},[20,125,126],{},"Static or JAMstack sites",": Nginx serves pre-rendered HTML effortlessly.",[35,129,130,133],{},[20,131,132],{},"Memory-constrained servers",": Nginx makes better use of limited resources.",[35,135,136,139],{},[20,137,138],{},"Modern stacks"," with load balancers, reverse proxy, frontline caches.",[35,141,142,145],{},[20,143,144],{},"WebSockets, HTTP\u002F2 and HTTP\u002F3",": Nginx has excellent support and an easier configuration.",[11,147,149],{"id":148},"what-matters-more-than-the-engine","What matters more than the engine",[16,151,152,153,156],{},"In most real websites we see, the bottleneck ",[20,154,155],{},"isn’t Apache or Nginx",": it’s a poorly configured PHP-FPM, MySQL with no indexes, unoptimised images or missing application cache.",[16,158,159],{},"Switching from Apache to Nginx and expecting the site to be twice as fast without touching anything else usually disappoints. It’s worth more to:",[161,162,163,170,173,180,183],"ol",{},[35,164,165,166,169],{},"Enable ",[20,167,168],{},"OPcache"," in PHP.",[35,171,172],{},"Move PHP up to 8.3 or higher.",[35,174,175,176,179],{},"Use ",[20,177,178],{},"object caching"," (Redis, memcached).",[35,181,182],{},"Index the database properly.",[35,184,185],{},"Serve images via CDN.",[16,187,188],{},"If after that you still hit performance issues, then it makes sense to rethink the front layer.",[11,190,192],{"id":191},"minimum-recommended-setup-2026","Minimum recommended setup (2026)",[16,194,195],{},"In both Apache and Nginx:",[32,197,198,207,213,219,228],{},[35,199,200,203,204,206],{},[20,201,202],{},"PHP-FPM"," (not ",[42,205,44],{},").",[35,208,209,212],{},[20,210,211],{},"HTTP\u002F2"," enabled and SSL certificate via Let’s Encrypt.",[35,214,215,218],{},[20,216,217],{},"Brotli compression"," alongside gzip.",[35,220,221,224,225,206],{},[20,222,223],{},"Proper cache headers"," for static files (1 year with ",[42,226,227],{},"immutable",[35,229,230,233],{},[20,231,232],{},"Slow query log"," enabled to spot DB bottlenecks.",[11,235,237],{"id":236},"wrap-up","Wrap-up",[16,239,240,241],{},"In 2026 there is no clear \"winner\" between Apache and Nginx for PHP. There is a more useful question: ",[20,242,243],{},"what does your team know and what runs better in production for you?",[16,245,246,247,250],{},"If you’re starting from scratch, ",[20,248,249],{},"Nginx + PHP-FPM"," is usually more resource-efficient and easier to configure for modern use cases. If you’re coming from Apache and everything works, don’t migrate just because of trends: invest that time in optimising PHP, the database and caching.",[16,252,253,254,259],{},"If you have a server with PHP that runs slow and you don’t know where to look, ",[255,256,258],"a",{"href":257},"\u002Fen\u002Fcontacto\u002F","we can audit it for you",", no strings attached.",{"title":261,"searchDepth":262,"depth":262,"links":263},"",2,[264,265,266,267,268,269,270,271],{"id":13,"depth":262,"text":14},{"id":29,"depth":262,"text":30},{"id":57,"depth":262,"text":58},{"id":78,"depth":262,"text":79},{"id":112,"depth":262,"text":113},{"id":148,"depth":262,"text":149},{"id":191,"depth":262,"text":192},{"id":236,"depth":262,"text":237},"2026-04-10","The Nginx vs Apache debate has been around for years. In 2026 the answer isn’t the same as in 2018. Here’s when to pick each one and why benchmarks don’t tell the whole story.","md","\u002Fog\u002Fog-default.png",{},true,"\u002Fen\u002Fblog\u002Fnginx-vs-apache-php-2026",{"title":5,"description":273},"en\u002Fblog\u002Fnginx-vs-apache-php-2026",[282,283,284],"Servers","Linux","PHP","jsbVZ4mTxHgWMbC5d5ZfrLyVZEMCpYuxUwdLPoOP8cs",1777289997061]