3 ms·
Question: Is there any advantage to using nginx over apache if you are not hosting a huge traffic website that uses lots of long polling etc?
by jiggy2011 15y ago
Question: Is there any advantage to using nginx over apache if you are not hosting a huge traffic website that uses lots of long polling etc?
- EwanToo 15y agoIt depends is the only honest answer. However, personally I find it uses less memory, which if nothing else frees up space for other processes
- jiggy2011 15y agoPhrased another way, if Apache's performance is adequate are there any non-performance advantages to nginx?
- zzzcpan 15y agoNo.
- powersurge360 15y agoWell, I'd argue that configuration is nicer with nginx than with apache if you're running something other than php. But the trade off there is nginx only has centralized config whereas you can do .htaccess stuff with apache, so meh.
- untog 15y agoTrue. But if you already have your Apache configs complete then it might not be worth switching at this point.
- billpatrianakos 15y agoNot really. The standard "it depends" answer usually doesn't take personal preference and choice of language into account though. I'm used to seeing the Apache or Nginx question framed in a way that's all about performance but performance isn't everything. Nginx configuration will probably feel a little foreign to you because you're used to Apache. There's a bit of a learning curve with Nginx too. Apache modules are something I feel are important and Nginx doesn't really have anything comparable that just works out of the box. Nginx has a large community and good docs so its not like it's hard to Google your way through any issues that crop up bit Apache has more because it's so damn common. So the more obscure the issue the harder it'll be to find the answer compared to Apache. But then again some platforms work better with and are partial to Nginx. The Rails community is one that I can think of that seems to put a lot of effort into making it easy to run Rails apps on Nginx out of the box. I'd argue that they actually put more effort into supporting Nginx out of the box than Apache. I've heard it's easier to get multiple SSL sites working in Nginx than it is with Apache so if that's important I might look into it. I think your background is also a factor. I'm not a server guy. I'm a programmer. I write code, put it on a server and would prefer not to get into too much detail with the server configuration. So to me, Apache feels like the better choice because any time I want to use a new framework or anything that's going to run on the server the docs are always written in a way that assumes you use Apache. It's rare that I see setup instructions that include Nginx configurations too. One exception is Passenger which goes out of its way to show you how to use it on both Apache and Nginx. I'm sure that my reasons for choosing one over the other aren't relevant to hardcore server people because they're far more well versed in how server software works than a front end dev or even a backend dev. I also want to point out that while Nginx is fast out of the box you can still get comparable performance out of Apache. You just have to do a little homework and get your hands dirty in the confit files. I hope my answer wasn't perceived as saying one is better than the other. I just wanted to expand on the standard "it depends" answer because a need for speed and your site's traffic are just the tip of the iceberg.
- ori_b 15y agoI found nginx more pleasant to set up.
- brendoncrawford 15y agoSome would say it is easier to setup and manage.
- FuzzyDunlop 15y agoI would concur. I've found it easier to write an nginx config than an Apache one. It's not ideal for basic PHP dev, what with the lack of .htaccess equivalent, but other than that, I definitely prefer it.
- otterley 15y ago> I've found it easier to write an nginx config than an Apache one I found the opposite - mod_rewrite is way more powerful and has less surprising behavior than nginx's version. nginx's "if" blocks in particular are quite hairy -- note the Wiki page name: http://wiki.nginx.org/IfIsEvil http://wiki.nginx.org/IfIsEvil