为什么要在框架 Web 服务器之前使用 http 服务器? [英] Why should one use a http server in front of a framework web server?

查看:22
本文介绍了为什么要在框架 Web 服务器之前使用 http 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

诸如 sinatra (ruby)、play (scala)、lift (scala) 等 Web 应用程序框架会生成一个侦听特定端口的 Web 服务器.

Web applications frameworks such as sinatra (ruby), play (scala), lift (scala) produces a web server listening to a specific port.

我知道有一些原因,例如安全性、集群以及在某些情况下的性能,可能会导致我在我的 Web 应用程序前面使用 apache Web 服务器.

I know there are some reasons like security, clustering and, in some cases, performance, that may lead me to use an apache web server in front of my web application one.

根据您的经验,您对此有什么理由吗?

Do you have any reasons for this from your experience?

推荐答案

  • 任何网络应用程序的一部分都是完全标准化和商品化的功能.像 nginx 或 apache 等成熟的 web 服务器可以做以下事情.他们可以以一种更正确、更高效、更稳定、更安全、对系统管理员更熟悉,并且比您在应用程序服务器中重写的任何内容更容易配置的方式来完成以下事情.
    • 提供静态文件,例如 HTML、图像、CSS、javascript、字体等
    • 处理虚拟主机(单个 IP 地址上的多个域)
    • 网址重写
    • 主机名重写/重定向
    • TLS 终止(感谢@emt14)
    • 压缩(感谢@JacobusR)
    • 如果您想在 1 月 30 日的 Airbnb 技术演讲中获得 Isaac Schluetter 的半官方回答,2013 大约 40 分钟,他解决了节点是否稳定的问题 &足够安全,可以直接连接到 Internet.他的回答基本上是是",这很好.所以你可以这样做,从稳定性和安全性的角度来看,你可能会很好(假设你正在使用集群来处理应用服务器进程的意外终止),但如上所述,当前操作的现实是几乎每个人都运行节点在单独的网络服务器或反向代理/缓存后面.

      And just in case you want the semi-official answer from Isaac Schluetter at the Airbnb tech talk on January 30, 2013 around 40 minutes in he addresses the question of whether node is stable & secure enough to serve connections directly to the Internet. His answer is essentially "yes" it is fine. So you can do it and you will probably be fine from a stability and security standpoint (assuming you are using cluster to handle unexpected termination of an app server process), but as detailed above the reality of current operations is that still almost everybody runs node behind a separate web server or reverse proxy/cache.

      这篇关于为什么要在框架 Web 服务器之前使用 http 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆