8 ms·
Isn't nginx more often than not used as a front controller for apache/tomcat/etc?
by czervik 15y ago
Isn't nginx more often than not used as a front controller for apache/tomcat/etc?
- iSloth 15y agoIt can be used like that, however I am not sure if that's the most implemented method. Personally I use Nginx > PHP-FPM, so there is no other web server on the box.
- asto 15y agoEarlier, nginx was used to handle just static content and passed the php stuff to apache httpd. These days people just use php-fpm instead so nginx can handle everything in a php based stack without needing apache.
- lhnz 15y agoIs this faster or the same speed? There is so much FUD around this topic that I've not been able to get through.
- asto 15y agoNginx + php-fpm is MUCH faster than a vanilla apache httpd + php stack. The magic though, is not just speed. It's also the feature-set. I'm working on a pyramid(pylons) project right now and will be using nginx to load-balance the wsgi server instances and to serve static content. I don't think I could use apache for that. The configuration for nginx looks neater as well (my personal opinion)
- gog 15y agoAre you sure about that? Benchmarks on my projects show that the difference is insignificant. Since I currently do not have memory constraints I am still using nginx + apache with mod_php.
- asto 15y agoI remembered the benchmarks as being well in nginx's favour but it seems I was mistaken. As maratd has noted above, apache with mod_php is faster. But like I said, nginx is great for doing loads of things and I sort of "quit php" recently so I don't really care about php performance anyway.
- maratd 15y agoUsing mod_php with Apache IS faster than PHP-FPM, however, it uses MUCH more RAM. In a RAM constrained environment like a VPS, it simply isn't an option.
- pwaring 15y agoThe latter part is simply not true - I run Apache with mod_php for a number of sites and web services on VPS's with little RAM without any problems, and that's alongside MySQL, Exim and SpamAssassin.
- JonnieCache 15y agoWhat's the traffic though?
- pwaring 15y agoI don't have exact figures, but each site probably gets a few hundred hits/day, and the mail server probably gets hit every few seconds. The OP made a sweeping "not an option" statement though, not "on a popular site hosted on a VPS".
- maratd 15y agoLet me re-phrase. Using Apache + mod_php in a RAM constrained environment is not an option on any site that receives more than a dozen requests per second, assuming proper configuration. However, that figure is unbelievably limiting. The site can't be used for anything other than a very low traffic internal site or a dead blog. Even a tiny spike in traffic will destroy your setup. If you switch to Apache + PHP-FPM you can increase your capacity 10X with the same hardware. Literally. Most resources on a website are static and loading PHP for all of them is a pointless waste of RAM.