TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The Architecture of Open Source Applications: Nginx

292 点作者 larsvegas_超过 9 年前

15 条评论

sinzone超过 9 年前
Lua support in nginx is phenomenal, especially when combined with LuaJIT. It basically allows to transform nginx into an application server and run arbitrary code that can pretty much do anything.<p>I would like to mention agentzh and his team that did an amazing job in releasing OpenResty[1] which makes it easy to extend nginx with custom Lua functionality, which also happens to be the backbone of CloudFlare architecture, and the core technology being used by projects like Kong[2] when it comes to microservices management.<p>[1] <a href="http:&#x2F;&#x2F;openresty.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;openresty.org&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;Mashape&#x2F;kong" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Mashape&#x2F;kong</a>
评论 #10618702 未加载
评论 #10620469 未加载
nisa超过 9 年前
I really enjoy nginx, as it&#x27;s more flexible to configure but I&#x27;ve never understood why Apache got this slow label...<p>FTA: In February 2012, the Apache 2.4.x branch was released to the public. Although this latest release of Apache has added new multi-processing core modules and new proxy modules aimed at enhancing scalability and performance, it&#x27;s too soon to tell if its performance, concurrency and resource utilization are now on par with, or better than, pure event-driven web servers. It would be very nice to see Apache application servers scale better with the new version, though, as it could potentially alleviate bottlenecks on the backend side which still often remain unsolved in typical nginx-plus-Apache web configurations.<p>I&#x27;m using Apache 2.4 with mpm_event + mod_proxy_fcgid and it&#x27;s doing fine - 99% of the work and time spend is done in the FastCGI application anyway and for static content mpm_event is good enough. I wouldn&#x27;t run a dedicated static CDN box on Apache but for everything that can run on a single server Apache can also do the job... even HTTP&#x2F;2 with mod_h2 works fine as of 2.4.17<p>A problem with nginx is to figure out what matches in a complex config... it&#x27;s not straightforward. .htaccess is nice and simple for a shared server with lot&#x27;s of users.<p>I really like nginx but I guess most people just don&#x27;t really need it. Migrating to 2.4 and mpm_event should be good enough.
评论 #10617806 未加载
评论 #10617931 未加载
评论 #10618347 未加载
评论 #10619851 未加载
评论 #10618045 未加载
evincarofautumn超过 9 年前
No matter how many times I see “nginx”, and know that it’s supposed to be “engine X”, I always pronounce it as [ŋɪŋks] in my head!<p>The way nginx handles requests and responses in an implicit event loop reminds me of a recent talk by Brian Kernighan, in which he mentions the ubiquity of the “pattern–action” model in many domains. I think it’s a very useful architectural pattern to have in mind when you’re designing a configuration system or a DSL.<p>I also liked this quote:<p>&gt; …it is worth avoiding the dilution of development efforts on something that is neither the developer’s core competence or the target application.
评论 #10617805 未加载
评论 #10618217 未加载
评论 #10617646 未加载
评论 #10619585 未加载
评论 #10617536 未加载
评论 #10617693 未加载
评论 #10618545 未加载
arca_vorago超过 9 年前
While I like nginx over apache because I&#x27;ve been burned too many times by strange apache configs, I have recently found and am growing to love Hiawatha. It&#x27;s a GPL webserver focused on security, uses PolarSSL which jut got bought out and is now mbed, and it&#x27;s pretty fast. All the benchmarks I&#x27;ve seen show it comparable to stock nginx, apache, but once you tack on some of the optimizations nginx will beat Hiawatha. It also has a very easy config syntax.<p>Just for anyone interested: <a href="https:&#x2F;&#x2F;www.hiawatha-webserver.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.hiawatha-webserver.org&#x2F;</a><p>The dev doesn&#x27;t do much advertising, so word of mouth on a place like HN really helps.
评论 #10627110 未加载
alexandrerond超过 9 年前
Every &quot;new&quot; webserver tries to fix apache configuration syntax mess, and imho they all fail. Yes, setting up a reverse proxy looks simpler with nginx or haproxy for that matter. Now when it comes to complex configurations they all suck, and I&#x27;m not sure a json&#x2F;yaml config format is going to fix that as long as webservers have such wide scopes (from serving static pages, to proxying traffic, authorizing, authenticating, encrypting...). At least apache is very modular on this regard and some credit should be given to it having survived and evolved along with all the newer options.
评论 #10618068 未加载
评论 #10623151 未加载
davidmichael超过 9 年前
I wish there was more input as to why Apache 2.4 isn&#x27;t suitable. It&#x27;s been 3 years since its event driven model was released and it is a perfectly acceptable web server even for static content.
评论 #10617821 未加载
davidw超过 9 年前
&gt; Although Apache provided a solid foundation for future development, it was architected to spawn a copy of itself for each new connection<p>That&#x27;s not really correct:<p><a href="https:&#x2F;&#x2F;httpd.apache.org&#x2F;docs&#x2F;2.2&#x2F;mod&#x2F;prefork.html" rel="nofollow">https:&#x2F;&#x2F;httpd.apache.org&#x2F;docs&#x2F;2.2&#x2F;mod&#x2F;prefork.html</a><p>Nginx makes it easier to handle a bunch of concurrent connections, but it&#x27;s not as if Apache simply forks for each new connection.
评论 #10617746 未加载
jrochkind1超过 9 年前
&gt; In February 2012, the Apache 2.4.x branch was released to the public. Although this latest release of Apache has added new multi-processing core modules and new proxy modules aimed at enhancing scalability and performance, it&#x27;s too soon to tell if its performance, concurrency and resource utilization are now on par with, or better than, pure event-driven web servers.<p>When was this written? Is it still too soon to tell? 2.5 years seems like enough time to tell?
评论 #10618479 未加载
maattdd超过 9 年前
More impressive in the same book, how another server (Warp) written in Haskell (GCed lazy functional language, supposedly way slower than C over epoll) achieves the same performance as nginx!<p><a href="http:&#x2F;&#x2F;www.aosabook.org&#x2F;en&#x2F;posa&#x2F;warp.html" rel="nofollow">http:&#x2F;&#x2F;www.aosabook.org&#x2F;en&#x2F;posa&#x2F;warp.html</a>
gtrubetskoy超过 9 年前
Back when I was tinkering with mod_python performance[0] there was this web server called nxweb[1], which out-performed nginx consistently by quite a bit.<p>[0] <a href="http:&#x2F;&#x2F;grisha.org&#x2F;blog&#x2F;2013&#x2F;11&#x2F;07&#x2F;mod-python-performance-revisited&#x2F;" rel="nofollow">http:&#x2F;&#x2F;grisha.org&#x2F;blog&#x2F;2013&#x2F;11&#x2F;07&#x2F;mod-python-performance-rev...</a> [1] <a href="https:&#x2F;&#x2F;bitbucket.org&#x2F;yarosla&#x2F;nxweb&#x2F;overview" rel="nofollow">https:&#x2F;&#x2F;bitbucket.org&#x2F;yarosla&#x2F;nxweb&#x2F;overview</a>
anowlcalledjosh超过 9 年前
Why do web servers always seem to invent their own config file format? Whilst nginx seems to do it slightly more sanely than Apache, it still doesn&#x27;t use something like YAML or JSON; is there a good&#x2F;obvious reason for this I&#x27;m missing?
评论 #10617410 未加载
评论 #10617295 未加载
评论 #10619073 未加载
评论 #10617915 未加载
评论 #10617861 未加载
评论 #10617259 未加载
评论 #10623308 未加载
评论 #10617844 未加载
评论 #10617347 未加载
评论 #10621178 未加载
losvedir超过 9 年前
Does anyone know how this architecture compares to cowboy? I know erlang is known for concurrency, but I&#x27;m assuming erlang isn&#x27;t as fast as the custom-tailored C here. OTOH, I feel slightly less concerned about security issues with erlang.
评论 #10619575 未加载
评论 #10619610 未加载
DonnyV超过 9 年前
I love using nginx but it seems that all the new features lately are only accessible through their enterprise service.
评论 #10618766 未加载
ferbivore超过 9 年前
Sort of unrelated, but I would love to see one of these for Unreal Engine. If there&#x27;s an internal architecture overview somewhere, I haven&#x27;t found it.
jsprogrammer超过 9 年前
&gt;These days the Internet is so widespread and ubiquitous it&#x27;s hard to imagine it wasn&#x27;t exactly there, as we know it, a decade ago. It has greatly evolved, from simple HTML producing clickable text, based on NCSA and then on Apache web servers, to an always-on communication medium used by more than 2 billion users worldwide.<p>The Internet[0] has a much richer history and larger ecosystem than just the World Wide Web. The Internet started nearly six decades ago, the web has only been around for a bit more than two.<p>[0] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Internet" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Internet</a>
评论 #10617602 未加载
评论 #10617603 未加载