skip to Main Content

I am confused as to why when building a node/express application I dont need to use another web server but when working with Java or Spring or a python backend usually a webserver like nginx or apache is used. I am getting confused as to what Apache and nginx do, don’t they just handle HTTP requests just like we do in node or express? But then in Spring there are controllers that handle the requests so why do we need to have JBoss or Apache running?

2

Answers


  1. If you are writing a NodeJS application then you don’t “need” another server, except maybe when you are scaling a production ready deployment

    The simple answer is that express, Apache, nginx and JBoss are all web server. Since all of these are web servers they each can pretty much do the work of each other. However, each of them have strengths and weaknesses which is why often times they can work together. For example a common practice is to place an express server behind nginx to let nginx handle load balancing, static assets and SSL termination which nginx is very good at but maybe let API and websocket connections fall through to the express server which is what express is typically good at.

    A developer may pick Apache if they are working with PHP because the integration is so good but pick JBoss if they are working with Java EE.

    Login or Signup to reply.
  2. In the old times there was a strict separation between the “application” and the “application server”/”web server”. Application servers (like JBoss) provided the configuration of the resources (connections to DB for example), etc. to the application deployed on them. Web servers (like Apache) provided the configuration for possibly multiple web applications hosted on them.

    Currently, in the era of self-hosted apps (which means: apps that contains embedded HTTP server) you often don’t need a separate webserver. But tools like Nginx are still used for example as load-balancers, etc. Application servers (JBoss, etc.) are not often used nowadays, because of the embedded HTTP servers that you’re able to configure without asking Ops-people to do it for you – it’s quicker and more convenient.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search