
Nginx Is Taking Over the Internet - cliveowen
http://www.wired.com/wiredenterprise/2013/09/nginx/
======
dmm
Nginx has been added to the OpenBSD base system which means it has been
security audited and will someday replace the fork of Apache 1.3 as the
primary httpd in OpenBSD.

[http://marc.info/?l=openbsd-
misc&m=134684032310189&w=2](http://marc.info/?l=openbsd-
misc&m=134684032310189&w=2)

~~~
eksith
We already moved to Nginx on OpenBSD before 5.2. It was a nice surprise for us
when this happened and, although it's not the bleeding edge Nginx release
that's available, it was much appreciated since that meant upgrades wouldn't
be as difficult from then on.

I should mention that Apache had been good to us in the past, despite being
the 1.3 series with patches bundled with OpenBSD, but we were expecting far
more from it than it was originally intended to do. In that regard,
configuration and deployment became much simpler since we moved to Nginx.

~~~
danielweber
Went to nginx on OpenBSD myself, mostly because at some point the latest
lighttpd was not playing well with the latest OpenSSL. Never looked back
since.

~~~
eksith
One of our clients had an issue with lighttpd and OpenSSL, but that was on
Debian. Turns out it was a known issue: [http://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=622733](http://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=622733)

You may have seen the same or related problem, since it takes a bit while for
packages to come to OpenBSD. But either way, you ended up with something that
worked well :)

------
devx
'Would they have considered obscure Russian software if they hadn’t been able
to examine the source code? “Never in a million years,” Prince says. “If it
hadn’t been open-source, we wouldn’t have trusted it.”'

And _that 's_ how a lot of countries will feel about using proprietary (or
even open source) software from US in the future, after all the NSA
revelations.

~~~
chatman
Open source software is not same as free software. One needs free software
(which is open source, as well as give users complete freedom) to ensure their
privacy.

~~~
Xylakant
In terms of trust: No. As long as I can get the source, modify it and compile
my own version, I'm totally in the green as far as privacy and security are
concerned.

There's a lot of reasons to prefer free software over mere open source
software, but privacy is none of them.

~~~
chatman
Android is "open source", yet there may be restrictions on your ability to
compile and run your copy of the source code on your device. Can you trust the
OEMs that they are running the same code as you have a copy of?

------
leephillips
From the article: "Apache would crash, especially when WordPress was really
busy. 'We realized that it wasn’t super-stable under production traffic,' says
Barry Abrahamson, a WordPress 'systems wrangler'"

Given Apache's track record and massive deployment, how could this be
possible? Isn't it more likely that the Wordpress people were doing something
wrong? Not that Nginx isn't great, but I'm bemused by the occasional
suggestions I see that it's saving us from the suddenly broken Apache.

~~~
gnaritas
Apache rocks and is battle tested, the problem for them is that Wordpress is
PHP which requires the process model worker for stability because PHP isn't
thread safe and developers write shitty code assuming it is.

~~~
eksith
"...because PHP isn't thread safe and developers write shitty code assuming it
is."

[http://www.iis-
aid.com/articles/my_word/difference_between_p...](http://www.iis-
aid.com/articles/my_word/difference_between_php_thread_safe_and_non_thread_safe_binaries)

"Another option is to configure IIS to use PHP in FastCGI mode which allows
PHP processes to be recycled rather than killed off after each PHP request and
also allows you to run several PHP processes at once, making PHP much much
faster with the added bonus that as it is using the CGI interface there is
little or no incompatibility issues with PHP extensions. This is still the
fastest way to serve PHP, and is the way the IIS Aid PHP Installer is
configured to install PHP on your IIS Environment."

~~~
X-Istence
PHP-FPM is also pretty awesome.

------
badmadrad
I'm a noob at this system admin stuff but according to my statistics I have
gathered, nginx webserver uses 30-50% less of the load than apache.

At first, I poured so much into learning Apache I didn't want to learn this
weird obscure Russian alternative but I am sure glad I did.

Under load testing, I can have double the amount of concurrent users without
even causing my server to hiccup.

When I was running wordpress and apache in AWS I had to use a costly m1-small
instance to maintain the cpu and load needs of apache.

When I made the switch to nginx I doubled the performance and was able to move
to a free micro instance in AWS.

In conclusion, moving to nginx saved me money and allowed my server to run
more efficiently.

I am a believer in this software. Hopefully, going commercial doesn't ruin it
like money usually does.

~~~
babuskov
Just double? I managed to get around 8-10x performance from the same hardware.
I do not run Wordpress, though, but my custom PHP code.

------
casca
I suspect that tech people are less concerned with country of origin that many
other industries. I'd like to believe that my experience is generalizable and
that as a group we're more of a meritocracy. Perhaps it's due to the diversity
of people that we routinely work with?

~~~
aegiso
I suspect you're right, but I don't think we should be patting ourselves on
the back.

The legal profession has the bar. Doctors need accreditation. Builders need
licenses for their jurisdiction.

But software? It doesn't matter who wrote it or where because bits are just
bits, especially when you tread into opensource land.

We're a meritocracy because that's the nature of the industry, not because
we're particularly benevolent.

~~~
lmm
There's nothing inherent about the industry that means it has to be that way.
We deserve a little credit for not putting artificial barriers in place like
other industries have.

~~~
patmcc
Barriers aren't necessary artificial or terrible. Unless you'd like your
"doctor" to have no accreditation or training.

------
mfjordvald
As someone who was there early on writing documentation and helping in IRC
it's extremely nice to see the article mention how volunteers really got this
projects documentation off the ground. Hats off to nginx for sharing that
tidbit or to the article author if he researched that independently.

~~~
vangale
I, for one, really appreciate your work (and anyone else who contributed to
docs of course). I remember the days when we had to figure stuff out just by
looking at other people's config files. I think I even got some of my earliest
SO points just from posting sample nginx configs.

------
progx
A long time ago the development of apache walks into a wrong direction. Apache
get fat and slow.

For now nginx is first choice for Webperformance, but in some years the next
thing will arrive.

~~~
gnaritas
Apache isn't dead, nor slow, nor going anywhere. As a pluggable module based
server, new worker modules will ensure it keeps up just fine.

~~~
TylerE
The difference is actually pretty massive.

See
[http://wiki.dreamhost.com/Web_Server_Performance_Comparison](http://wiki.dreamhost.com/Web_Server_Performance_Comparison)
for instance.

~~~
gnaritas
That's a completely invalid and biased test. They forced Apache into it's
worst scaling mpm module, the process based model, which by the way _is not
the default_ , and then conclude Apache doesn't scale as well after
intentionally breaking it. Lies lies and damn lies.

~~~
TylerE
Aka the mode you have to use if you don't want PHP to blow up.

~~~
gnaritas
It's not Apache's fault PHP sucks. Use a better language and Apache works fine
with a modern worker module. The issue here is not Apache, it's PHP.

~~~
TylerE
But the point is Nginx lets you have your cake and eat it too....no issues
with PHP _and_ fast performance _and_ less memory usage.

~~~
gnaritas
That's great, but it's got nothing to do with Apache. If you choose a shitty
language, and PHP is shitty no matter how popular it gets, you're limited in
choices elsewhere. There's clearly a market for Nginx, low memory virtual
servers running PHP. Remove PHP and use a better language and Apache scale
just fine even in low memory conditions because without PHP, you don't have to
use the old fashioned process model. Apache can work with PHP-FPM just like
Nginx using the new evented worker mpm, but as PHP devs clearly find Apache
confusing there's no reason to bother.

~~~
timdev2
> without PHP, you don't have to use the old fashioned process model.

Immediately followed by:

> Apache can work with PHP-FPM just like Nginx using the new evented worker
> mpm

seems contradictory. Can you clarify this bit?

~~~
gnaritas
The Apache evented worker is very new, just out in 2.4, so it's still standard
practice to use the process model. The new way should bring it inline with
Nginx but it's too new to say if it's as stable as Nginx; at least for me to
say it.

~~~
timdev2
There are now three major MPMs:

Prefork - if you want to use mod_php, you're stuck with this. I think this is
what you're referring to as "the process model"

Worker - Uses threads to handle connections. A big step up from prefork, but
not as awesomesauce as nginx.

Evented - The new MPM which use epoll

It's been possible to run PHP(-fpm) under "worker" (via FastCGI) for years,
and it performs adequately. I never benchmarked, but I was using this setup
back when nginx was still too bleeding-edge for my tastes, and it certainly
beat the pants of prefork/mod_php

------
caycep
Good to see this get some English language press - I think the only other
profile of Igor Sysoev I've seen was a volunteer-translated copy of a Russian
language article.

~~~
da02
Do you remember the title? Or some keywords to find in online?

~~~
a3n
Perhaps this: [http://mindend.com/index.php/interview-with-the-creator-
of-n...](http://mindend.com/index.php/interview-with-the-creator-of-nginx/)

found here:
[https://en.wikipedia.org/wiki/Igor_Sysoev](https://en.wikipedia.org/wiki/Igor_Sysoev)

"This is an interesting interview with a creator of one of the best web
servers out there. The original interview is in Russian and the translation
(by google) is fairly difficult to read. I took a crack at writing a better
translation and I think this might be a bit better."

~~~
caycep
Thanks, I think that was what I was thinking about too. It's a better article
than the Wired one.

This was another one I just googled:
[http://www.freesoftwaremagazine.com/articles/interview_igor_...](http://www.freesoftwaremagazine.com/articles/interview_igor_sysoev_author_apaches_competitor_nginx)

------
lkrubner
For my style of coding, and I think many others, Nginx has become dominant
because it enables fast reverse proxy. And I think for many large websites it
ahs become common to build websites out of many small apps, which run on
different ports and which Nginx then knits together.

An example. Assuming you have the domain “example.com” then you might have an
app that handles user login and you spin that up on, say, port 30000 and you
map it to port 80 such that is appears as:

[http://www.example.com/login](http://www.example.com/login)

You might also have an app that handles user signups which you spin up on port
30001 and you map to port 80 such that it appears as:

[http://www.example.com/signup](http://www.example.com/signup)

You might also have an admin app that you spin up on port 30002 and you map to

[http://admin.example.com/](http://admin.example.com/)

You might also have an app that allows users to update their profile
information and you spin that up on port 30003 and map that to

[http://www.example.com/profile](http://www.example.com/profile)

And you might have an app that publishes much of your content as static HTML
files, which you spin up on no port, as it does not accept TCP/IP requests —
instead it queries the database and then creates static html files, which you
save to some directory such as /var/www/example.com/public_html/ and you map
that to

[http://www.example.com/](http://www.example.com/)

You can see how this gives the sysadmins a lot of freedom to spread load
across servers in creative ways — if 1 app becomes especially popular, or
resource hungry, the sysadmins can rather easily move it to its own server (or
set of servers). This is one of the main reasons most big sites move to an
architecture like this — it facilitates fine grained control of what sort of
requests go to a particular server.

This is a flexible style and it allows small, maintainable apps. By contrast,
consider web development circa 2001, when many people felt it was enough to
put a big blob of PHP in a directory and let Apache serve it as one big app.

Nginx's fast reverse proxy allows developers to focus on building their apps,
without having to worry too much the server details. It also offers a cleaner
separation between concerns that should worry programmers and concerns that
should worry the sysadmins.

(A final point: in my own apps, for information that needs to be shared
quickly across apps, like which users are logged in, I use ZeroMQ to knit the
apps together.)

~~~
gnaritas
People have been and still do exactly the same thing with Apache, this isn't
unique to Nginx in any way.

~~~
mintplant
I installed Apache recently along with ownCloud on my Raspberry Pi. I had to
strip it back out when I realized that Apache worker processes were keeping
the CPU and RAM at 100% the entire time, when nothing was even connected to
it.

I used to use Apache all the time way back when. The memories that stick with
me are of a massive tangle of configuration rules, mod_*, and htaccess files.
I've never looked back since going the way of Nginx. It's just so lightweight
in comparison, both performance- and maintenance-wise.

~~~
perbu
That a bug. Probably an architecture dependant one or some package maintainer
who messed up. Your experience with Apache httpd on your little homebrew
computer gadget doesn't say anything about Apache httpd and how it is usually
deployed.

Apache httpd is still bloody awesome.

~~~
mintplant
As stated in the same comment, my "little homebrew computer gadget" wasn't the
only platform I've run Apache httpd on. It was just yet another environment in
which it came out as sub-optimal when compared with Nginx in the same use
case.

------
hipsters_unite
What a ridiculous article title. Generates so much discursive noise and adds
nothing to the subject of the article.

~~~
derefr
I don't know, I thought it was cute. "You mean a botnet? [clicks] Oh, nginx!"

~~~
hipsters_unite
Well, that's exactly it. I thought "oh, hacking and/or botnets?" then read the
article and thought "why wasn't that called 'New Russian Server tech gains
market share' or something a little less pugilistic?"

------
imslavko
Regardless of your Nginx vs Apache Web server war here, Igor Sysoev
contributed to Apache a lot: mod_accel - (first?) reverse proxy, mod_deflate,
mod_realip.

------
LukeShu
Several of the comments here point out that part of the reason Apache gets a
bad rep is that PHP forces it to use the process based mpm, which is bad. Does
this mean that it would make more sense to use mod_fastcgi+php-fpm than
mod_php? If so, why isn't that being done?

~~~
j-kidd
In httpd-2.4.x (first released in Jan 2012), the event MPM is already the
default on Linux:

[https://httpd.apache.org/docs/2.4/mpm.html#defaults](https://httpd.apache.org/docs/2.4/mpm.html#defaults)

In httpd-2.2.x, however, the default MPM on Linux is prefork, i.e. the "bad"
one:

[https://httpd.apache.org/docs/2.2/mpm.html#defaults](https://httpd.apache.org/docs/2.2/mpm.html#defaults)

And those would be the "factory" defaults. Distributions can still put in
their own defaults, e.g. Ubuntu 12.04 LTS supplies httpd-2.2.x with the worker
MPM.

Anyway, Apache 1.3.x (built-in with something similar to the prefork MPM) +
mod_php was the de facto (or only?) way to deploy PHP scripts, as you can just
throw the scripts into the htdocs directory and they will just work.

------
ksec
I wonder what is planned for Nginx 2.0 I read somewhere ( The it was suppose
to be re-engineered.)

Edit: Here
[http://www.aosabook.org/en/nginx.html](http://www.aosabook.org/en/nginx.html)

------
DigitalSea
Does not surprise me. I use NGINX in unison with Apache and it allows me to
get maximum performance out of my $25 Linode VPS plan without having to scale
up and spend more money. Definitely the best thing to happen to the Internet
since Apache.

------
chrismealy
Anybody know how important epoll was in helping nginx take off?

~~~
justincormack
A lot of that stuff came from the discussion around the original c10k stuff
[http://www.kegel.com/c10k.html](http://www.kegel.com/c10k.html)

------
antonmks
Let's see the reasons why the author of nginx would not be accepted into
ycombinator :

Strong Russian accent : check

Over 40 years old : check

No revenue stream : check

~~~
Symmetry
Would NGINX Inc be the sort of company that would really benefit from
ycominbator investment and would be profitable for ycombinator to invest in?
We shouldn't assume that being selected for ycombinator is the measure of
worth towards which early stage companies should aspire.

------
zerop
Question: Is ngingx good for serving APIs as well. I read lots of places thats
its best for serving static contents...I got to serve REST API built using
JAVA.. response would not exceed 1KB.. Should I put nginx in front.... short,
bursty and highly number of concurrent requests.. Is nginx best-fit for API
serving....

------
ericgoldberg
nginx is a joy to configure and work with. I like the style of thinking of
"OK, I'll run this on port 7001 and just use iptables to forward 80 -> 7001"
Lets you run services as non-root, with the exception of the iptables one time
setup.

------
user2
Nginx Plus is a great supplement to nginx, especially for corporate users who
need a helping hand with the setup and maintenance of any complex system.
Thanks Igor!

------
foobeer
At least I now know to pronounce Nginx as "Engine X". Now I won't sound like a
fool next time someone asks which web server I'm using.

------
auvrw
gunicorn "strongly advises" nginx, so ...

------
johnnymonster
Lets all hope the NSA has not injected back doors into NGINX!

~~~
lampooned
Seems very unlikely. It's open source, so you can review the code and compile
it yourself.

~~~
talles
I believe that it was a joke.

------
jebblue
I'll stick with Apache, thanks.

------
chatman
Misleading title. A program written by a Russian isn't necessarily "Russian
Software".

~~~
Xylakant
Well, when nginx started out it was distinctively russian. As in "not a shred
of english doc". Everything you could find about it was russian. If that
doesn't make it "russian software", then I don't know what makes russian
software.

~~~
legutierr
Software written in Russian?

[http://en.wikipedia.org/wiki/Non-English-
based_programming_l...](http://en.wikipedia.org/wiki/Non-English-
based_programming_languages#International_programming_languages)

> In English, Algol68's reverent case statement reads case ~ in ~ out ~ esac.
> In Cyrillic, this reads выб ~ в ~ либо ~ быв.

