6 ms·
As someone younger who never really used Apache, I don't see any reason to do anything with it instead of Nginx. Other than supporting "legacy" setups, whats th
by ag_47 9y ago
As someone younger who never really used Apache, I don't see any reason to do anything with it instead of Nginx.
Other than supporting "legacy" setups, whats the point of Nginx load balancing Apache?
Configuring nginx is just so much more intuitive.
- pram 9y agoProbably a lot of mod_* uses like PHP applications that haven't been migrated to php-fpm or something, and JBoss/Tomcat/Websphere/Weblogic websites. You of course can just proxy all of these things with nginx, but it's probably not worth it for most companies.
- developer2 9y agoPHP is definitely a huge chunk of the reason why nginx has taken over Apache. php-fpm with nginx is the defacto standard, and PHP is far more prevalent than a lot of people think. Apache's mod_php(X) vs. nginx+php-fpm isn't even a debate. If someone is currently using Apache+mod_php, they probably have a smaller product that will eventually have to switch to nginx+fpm in order to scale. While I imagine PHP is the single largest reason, other languages that support or expect the use of fastcgi are also very easy to configure with nginx, whereas I can count on one hand the number of businesses I've seen using Apache's mod_fcgid.
- Zachery 9y agoI'm probably about 2 years out of being bleeding edge, but php-fpm&nginx are far from defacto standard. At least when you look at how the web is being served at large, looking at cPanel/WHM. I don't believe cPanel/WHM even supports nginx yet as a standard option.
- developer2 9y agoNot to be disrespectful - I know that cPanel and similar have their place - but no real business that expects to have a presence is using cPanel or any other "easy setup".
- wolco 9y agofpm is being dropped now that php 7 contains many of the improvements that made fpm popular. php_mod+apache with .htaccess turned off is the faster stack. Put a nginx server to server static content in front and that's the fastest stack going forward
- adrianfalleiro 9y agoFPM is being dropped? This is news to me, where can I read about this?
- wolco 9y agoAs people upgrade many are choosing PHP 7 through mod_php The below are links to benchmarks and discussions around mod_php vs. fpm. These are from last year 2016. Fast forward to today; I am seeing people move to php 7 and move back to mod_php. I believe we are at the start of a movement. Articles/stories will follow but only after the fact. https://www.symfony.fi/entry/symfony-benchmarks-php-fpm-vs-php-pm-on-php-7-and-hhvm https://www.symfony.fi/entry/symfony-benchmarks-php-fpm-vs-p... https://www.reddit.com/r/PHP/comments/4bi9a4/why_is_mod_php_faster_than_phpfpm/ https://www.reddit.com/r/PHP/comments/4bi9a4/why_is_mod_php_...
- developer2 9y agoThe first link is about PHP-PM, which is not mod_php, and is a new and unproven stack. The second link is a completely bullshit "echo 'Hello World';" with 100 concurrent requests - that benchmark is offering the stereotypical, utterly meaningless, metric. The fact is that Apache + mod_php will keep an instance of the PHP interpreter active in every single child httpd process. With nginx+fpm, your static assets are served directly from nginx without the overhead of an unnecessary PHP interpreter loaded into that process, while only your PHP requests are funneled to FPM. The performance overhead of having a PHP interpreter loaded into the process that is only serving a static asset is astronomical. At the end of the day, benchmark your shippable product. Never try to benchmark a "Hello World" or a Wordpress installation if you're not shipping a Hello World or Wordpress codebase. Purely based off professional experience, I have never seen a real-world app perform better on Apache+mod_php than on nginx+fpm. The only thing PHP 7 gave us was essentially the ability to ignore HHVM as a "required performance booster". 90% of companies were already able to ignore HHVM; with the improvements made to PHP 7, it's now 95-99%+ of products that don't need to evaluate HHVM as a mandatory alternative. And yes, nginx+fpm is still the defacto standard for PHP 7; the links you have provided do not say any different.
- mfontani 9y agoAt $main_work, the reason is that there's a bunch of RewriteRules which last I checked simply couldn't be done by NGINX. OTOH, Apache suffered from the "slow loris" attack, so the whole shebang ended up being nginx sitting in front of a few front-end apache instance kinds, which sit in front of a dozen or so backend apache instance kinds. I find it interesting that although on those servers there are 12x more Apaches than NGINX, it might get counted as a server "using nginx"... ... and that's just because the whole she-bang sits under cloudflare, which reports Server: nginx-cloudflare ;)
- aluminussoma 9y agoApache can mitigate slowloris attacks through mod_requesttimeout. I recommend using this.
- zzzcpan 9y agoBoth nginx and apache are vulnerable to slowloris. To mitigate an attack like that you need an architecture with a scheduler, that kills slow connections, not a naive event loop.
- smsm42 9y agonginx is much more simple than full-service servers like Apache. Which is good if you want to do something easy fast (like terminate TLS, proxy, load-balance, simple redirect, simple header munging, etc.). And not good if you want to do something more complex and get into learning how nginx rewrite rules really work (totally not obvious), how if and other predicates really work (multiple articles in docs suggest it's not obvious at all) and what limitations are needed to achieve the simplicity and quickness. So if you want your webserver to do something complex, you'd go for Apache. But may still put nginx in front for LB, static content, pre-cache TLS, etc.
- ag_47 9y agoFair point, but, > if you want your webserver to do something complex, you'd go for Apache I would tend to disagree. Assuming "complex" = "business logic", Apache hardly seems the right choice. PHP/Python/Node/GoLang or Lua right inside nginx would be more appropriate in most cases, imo.
- smsm42 9y agoThere are degrees of complexity, there's a kind of spectrum even. If you want a full-blown business logic that requires language like PHP or Go, it's insane to try and make Apache do it. If you need a set of simple rules that are within what Apache (including there all the module ecosystem) can and is designed to do, it would be a big mistake, costing a lot of scalability, to deploy high-level language instead. Right tool for the job, always.
- ag_47 9y ago> if you want your webserver to do something complex, you'd go for Apache > a set of simple rules that are within what Apache (including there all the module ecosystem) can and is designed to do
- smsm42 9y agoAgain, there are degrees of complexity. Very simple - nginx, kinda more complex - Apache, somewhat complex but still doable without using Turning-complete language - third-party Apache modules, needs Turing-complete language or you're wasting your time - Python/PHP/Perl/pick your poison.
- detaro 9y agoShared hosting setups where you want .htaccess support (or something comparable, but same basic issue: requires some additional layer to validate and generate a centralized nginx configuration, or some other extra layer, with Apache it is built in and well-documented). WebDAV support.
- ag_47 9y agoAs far as htaccess support, from the couple Shared hosting providers I've used, lighttpd has been the server of choice.
- gcb0 9y agoA: Features.