nginx 和lighttpd 哪个有更好的代码库可供学习?

发布于 2024-09-06 09:49:02 字数 105 浏览 2 评论 0原文

主要目标是学习流行的 Web 服务器代码库(用 C 实现),优先考虑结构/设计,而不是整个代码中的巧妙技巧。

我没有包括 Apache,因为它的代码库比上面提到的两个大一个数量级。

Primary goal is to learn from a popular web server codebase (implemented in C) with priority given to structure/design instead of neat tricks throughout the code.

I didn't include Apache since its code base is an order of magnitude larger than the two mentioned.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风和你 2024-09-13 09:49:02

Ngxinx 可能是我遇到过的最好的直接 C 代码库。我读过大量的 Apache,但读完后我总是感觉不干净,它是一团乱麻。

您不仅可以通过探索 Nginx 来了解 Web 服务器,还可以了解在 Unix 和 Straight-C 下编写网络软件的最佳实践,从代码架构到元编程技术。

我只听说过 Lighttpd 的好消息,但与 Nginx 相比,它的范围有限。因此,如果我是你,我会在 nginx 上投入时间。尽管 lighttpd 的范围有限,但作为第一个学习目标可能对您有益。

Ngxinx might just be the best straight-c code-base I have encountered. I have read large chunks of Apache, and I always came out feeling unclean, it is a monolithic mess.

You will not just learn about web-servers by exploring Nginx, but pretty much the best practises for writing networked software under Unix and straight-c, from code architecture to meta-programming techniques.

I have heard nothing but good things about Lighttpd, however it is limited in scope compared to Nginx. therefore I would invest time in nginx if I was you. Although lighttpd's limited scope might be beneficial to you, as a first target to study.

像你 2024-09-13 09:49:02

老实说,任何有价值的代码库中总会出现一些巧妙的技巧。然而,你可能不想听到的答案是,学习两者可能会很好,这样你就可以通过交叉点来学习。另一种选择可能真的会让您陷入“lighthttpd”方式或“nginx”方式等的困境。

Neat tricks always happen in any codebase worth its salt, to be honest. Nevertheless, the answer you probably don't want to hear is that it would probably be good to study both so you can kind of learn through the intersection. The alternative might really leave you stuck in a box of the "lighthttpd" way or the "nginx" way, etc.

清风挽心 2024-09-13 09:49:02

我没有包括 Apache,因为它的代码库比提到的两个大一个数量级。

实际上 Apache 代码是非常可读的。它有很大的代码库,因为它做了很多事情。但它结构良好并且很容易理解。您还可以查看 APR 库(Apache Portable Runtime),其中有很多值得学习的小东西。

在我看来,如果你想学习编程,你应该从低调的项目开始——而不是 HTTPd,而是更简单的东西。

nginx 和 LightHTTPd(就像 Apache)都是生产质量软件,这意味着学习曲线非常陡峭。不幸的是,学习通常意味着挖掘档案以了解为什么会这样 - 对于任何成熟的项目来说,这都是随着时间的推移而出现的。

如果您只是喜欢 C 语言并学习设计,您可能想查看 FreeBSD 或其衍生产品。根据我的经验,这是一个更好的起点:那里有很多各种级别的工具和库。他们的待办事项列表永远不会是空的,这可以很好地指导从哪里开始。

I didn't include Apache since its code base is an order of magnitude larger than the two mentioned.

Actually Apache code is quite readable. It has large code base because it does lots of things. But it is well structured and quite easy to understand. You can also check APR library (Apache Portable Runtime) which has plethora of small things to learn from.

IMO if you want to learn programming, you should start with lower profile projects - and not HTTPd, but something simpler.

Both nginx and LightHTTPd (just like Apache) are production quality software, meaning very steep learning curve. And the learning unfortunately often means digging archives to see why it is that way - that comes with age to any mature project.

If you are simply into C and learning design, you might want to check the FreeBSD or its derivatives. In my experience it is a better place for starting: there are lots of tools and libraries of all calibers there. And their TODO lists are never empty, what serves well as a guide to where to start.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文