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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

OpenResty – A fast web app server by extending Nginx

167 点作者 elektromekatron将近 10 年前

15 条评论

dividuum将近 10 年前
Even if you don&#x27;t intend to use build a complete web application using OpenResty, the underlying HttpLuaModule for nginx is awesome on its own if you&#x27;re using nginx already. It makes it easy (among other things) to build logic around requests before they are handed off to a backend service. I used it for two different problems that would be more difficult to implement otherwise:<p>* Classifying incoming requests based on various signals to detect DDOS patterns and moving those requests into different request limit zones. It&#x27;s used in production at a bigger hosting provider.<p>* Rewriting incoming requests to a certain path of an existing website to a different shared blog hosting provider and changing back HTML&#x2F;CSS&#x2F;JS so everything worked. It didn&#x27;t end up going into production, but it was pretty easy to build in under 100 lines of Lua code.<p>So when you&#x27;re bored and want to learn something useful, have a look at <a href="http:&#x2F;&#x2F;wiki.nginx.org&#x2F;HttpLuaModule" rel="nofollow">http:&#x2F;&#x2F;wiki.nginx.org&#x2F;HttpLuaModule</a>. It might help you someday.
评论 #9869803 未加载
pwm将近 10 年前
I have been using OpenResty for years now. The ability to run Lua scripts from within is great.<p>Story time: Some time ago we developed a CMS for a large art&#x2F;production company. One of the requirements was that everything must be access controlled including all assets (eg. images, videos). The site went live and all was good until one day when, for no apparent reason, our monitoring alreted extreme load and then the site went down. Not so good for a company that sells its tickets online... I got on the phone with them and turns out that they started using the CMS to store images used for newsletters, which they sent out to some 200K people that morning. Now normally this wouldn&#x27;t be such a big problem, but since all images were ACLd, this meant that instead of serving static files all requests went to the backend and pretty much killed it. The solution we came up with was to move the initial access control check for assets directly to OpenResty using Lua and Drizzle. So whenever a request came in for an image Openresty checked if it&#x27;s public and only if it was not did the request hit the backend, otherwise it was served directly. Once we pushed this live the load disappeared and never came back.<p>Also I wrote an init script for it (as we needed one for a DRBD setup). Maybe someone will find it useful, here it is: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;pwm&#x2F;d3260804b4ade0d81f29" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;pwm&#x2F;d3260804b4ade0d81f29</a>
评论 #9867722 未加载
erikcw将近 10 年前
I&#x27;ve had great results using OpenResty in combination with the Lapis[0] framework. Screaming fast and pretty easy to work with.<p>[0] <a href="http:&#x2F;&#x2F;leafo.net&#x2F;lapis&#x2F;" rel="nofollow">http:&#x2F;&#x2F;leafo.net&#x2F;lapis&#x2F;</a>
评论 #9866243 未加载
评论 #9866522 未加载
评论 #9866513 未加载
评论 #9866326 未加载
mtourne将近 10 年前
Rewriting the hodge podge of C, Perl and other custom bits of Nginx almost entirely in Lua and hiring its maintainer Yichun in the process where important steps for scaling up the CloudFlare&#x27;s CDN and make sure each node is running as hot as possible.<p>More on this from dotScale 2015: <a href="https:&#x2F;&#x2F;youtu.be&#x2F;LA-gNoxSLCE?t=7m40s" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;LA-gNoxSLCE?t=7m40s</a>
nickpsecurity将近 10 年前
Combining a fast, optimized web server with Lua for fast and robust web applications is a technique proven in the field by Barracuda Application Server [1]. It&#x27;s good to see people trying it for server apps. Thing I like about such a combo is that simpler web stacks are easier to secure and have fewer ways to fail in general.<p>[1] <a href="https:&#x2F;&#x2F;realtimelogic.com&#x2F;products&#x2F;barracuda-application-server&#x2F;" rel="nofollow">https:&#x2F;&#x2F;realtimelogic.com&#x2F;products&#x2F;barracuda-application-ser...</a>
akurilin将近 10 年前
Most of my nginx use has been to serve static assets and reverse proxy to web apps, so I&#x27;m not familiar with a lot of other use-cases here. What are some common problems I can solve with openresty vs what I can already do with nginx?
评论 #9869090 未加载
MichaelGG将近 10 年前
One big downside was that OpenResty doesn&#x27;t support SPDY, due to an apparent issue when running SPDY and Lua. SPDY was an easy double digit percentage perf gain for us, so it&#x27;s omission was odd.<p>I&#x27;ve had normal nginx with all the plugins (using the nginx-extras package, I think, from the ppa). No problem with Lua and SPDY at least in my use case (sending rendered HTML snapshots for anything with an HTML mime type).
评论 #9866728 未加载
nodesocket将近 10 年前
I know about OpenResty, but I am getting a blank page? Can&#x27;t even open Chrome developer tools on it. Very strange. Works fine in Safari and Firefox.
onyxraven将近 10 年前
a note: the image serving frontend and storage backend for the original twitter photos integration was written largely in openresty. I love it.
quicksilver03将近 10 年前
How do I debug a web application built in Lua on OpenResty? Is there some sort of debugger where I can execute code step-by-step or do I have to resort to writing to log files to understand what&#x27;s going on?
DaemonHN将近 10 年前
I think all the HN traffic might have crushed the website - I&#x27;m getting a blank page and when I refresh it seems to be stuck. Not very encouraging, assuming they&#x27;re using it to serve their main page.
评论 #9866401 未加载
xfalcox将近 10 年前
My default web server! Wrote last week a Discourse SSO implementation just using content_by_lua from OpenResty.
thirdreplicator将近 10 年前
This is the kind of &quot;outside the box&quot; kind of stuff I love. Thanks for sharing.
leftnode将近 10 年前
The navigation on this site is possibly the worst ever conceived. You can&#x27;t link to anything!
评论 #9866180 未加载
评论 #9866355 未加载
评论 #9866184 未加载
curiousjorge将近 10 年前
I wonder if people insisting that they use node.js for scalability and high concurrency (two false but popular reasons) will now reconsider their decision because this blows node.js out of the water.<p><a href="https:&#x2F;&#x2F;www.techempower.com&#x2F;benchmarks&#x2F;#section=data-r10&amp;hw=peak&amp;test=json" rel="nofollow">https:&#x2F;&#x2F;www.techempower.com&#x2F;benchmarks&#x2F;#section=data-r10&amp;hw=...</a>
评论 #9867051 未加载
评论 #9866609 未加载
评论 #9866574 未加载
评论 #9866794 未加载