Why do we need Nginx to run web applications on production environment?

Nishit Ranjan
1 min readMay 11, 2020

In the development environment, the dev server is responsible to run the web application. The dev server takes our files, processes them and then spits it out to the web browser. In short, dev-server is the absolute necessity for the development environment.

However, in our production environment, there is no dev-server. The dev-server, needs a lot of processing power whose purpose is to process all the JavaScript and html files. And since we don’t make any changes to our files in the production environment, we don;t need any processing power. Hence, we don’t need a dev-server.

In the production environment, we only need a server whose sole purpose is to respond to browser requests. The only job of the production server is to consume the incoming requests and respond to them with relevant files.

This is what Nginx does.

SO, once you have dockerized your web application, please make sure that you have a separate dockerfile for production that installs the nginx and runs the npm run build command.

--

--

Nishit Ranjan
0 Followers

I am a software engineer. I specialize in JavaScript, React.js, NodeJS, Docker and Kubernetes.