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

查看:117
本文介绍了为什么要在框架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?

推荐答案

  • 任何Web应用程序的一部分都是完全标准化和商品化的功能.成熟的Web服务器(如nginx或apache)可以执行以下操作.他们可以以比您在应用程序服务器中可以重写的任何方式更正确,更有效,更稳定,更安全,对系统管理员更熟悉,更易于配置的方式执行以下操作.
    • 提供静态文件,例如HTML,图像,CSS,javascript,字体等
    • 处理虚拟主机(一个IP地址上有多个域)
    • URL重写
    • 主机名重写/重定向
    • TLS终止(感谢@ emt14)
    • 压缩(感谢@JacobusR)
      • Part of any web application is fully standardized and commoditized functionality. The mature web servers like nginx or apache can do the following things. They can do the following things in a way that is very likely more correct, more efficient, more stable, more secure, more familiar to sysadmins, and more easy to configure than anything you could rewrite in your application server.
        • Serve static files such as HTML, images, CSS, javascript, fonts, etc
        • Handle virtual hosting (multiple domains on a single IP address)
        • URL rewriting
        • hostname rewriting/redirecting
        • TLS termination (thanks @emt14)
        • compression (thanks @JacobusR)
          • 一个有趣的例子:nginx处理本来会DoS node.js的攻击:以防万一,您想在1月30日的 Airbnb技术讲座上得到Isaac Schluetter的半官方答复, 2013 大约40分钟,他谈到了节点是否稳定的问题.安全到足以直接连接到Internet的连接.他的回答本质上是是",这很好.因此,您可以这样做,并且从稳定性和安全性的角度来看可能会很好(假设您正在使用群集来处理应用程序服务器进程的意外终止),但是如上所述,当前操作的现实是几乎每个人都在运行节点在单独的Web服务器或反向代理/缓存后面.

            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天全站免登陆