Similar to Django, frameworks such as express.js have the ability to handle backends. Why are server programs such as Apache and Nginx generally deployed in development environments?
習慣沉默2017-05-16 17:01:04
In different network environments, the demand for the network is not only the ability to communicate, but also many different demands. If the server is not isolated, it will be quite inflexible and it will be very troublesome to deal with these demands. Can't even finish. Here are some requirements:
High performance: nginx and apache can greatly improve the performance in different scenarios through configuration, and they are even more thoroughly optimized for high concurrency.
Security: Support for SSL and certificates, other servers may not implement it or implement it inconsistently.
Agent distribution: Unified entry points to avoid exposing complex internal environments.
巴扎黑2017-05-16 17:01:04
The Django tutorial says it at the beginning:
You've started the Django development server, a lightweight Web server written purely in Python. We've included this with Django so you can develop things rapidly, without having to deal with configuring a production server – such as Apache – until you' re ready for production.
Now’s a good time to note: don’t use this server in anything resembling a production environment. It’s intended only for use while developing. (We’re in the business of making Web frameworks, not Web servers.)
Taken from: https://docs.djangoproject.co...
The Web Server that comes with Django is just to simplify the development environment. It is not intended to be a reliable web server at all. It should never be used in an online production environment. You still need to use a professional server online. This is different from Tornado, which itself is a reliable server. As for Node.js, you can indeed use the one that comes with it, and there is no problem, but you have to know that
Node.js is single-threaded. If you have a 32-core server, it would be too wasteful to run a single-threaded Node.js program, so you will start multiple Node.js processes, listen to different port numbers respectively, and then use Nignx as a reverse proxy. In this way, server resources can be maximized.