What is Nginx

Nginx is a free, open source, high-performance Web server that can be used for reverse proxies, caching, and load balancing in addition to being an HTTP server.

Nginx was originally created to solve the C10K problem, and has become a popular Web server because of its advantages such as low resource consumption and high performance.

Nginx uses an asynchronous event-driven method to process requests. It cuts the overhead of context scheduling through asynchronous logic, so it has stronger concurrency capability. The overall modular design is adopted, and there are rich official and third-party module libraries.

Two, what are the advantages

  • High concurrency and high performance

  • Good scalability

  • High reliability

  • Hot deployment

  • DBD license

  • Stability, rich function set

  • Low resource consumption

Three, what are the disadvantages

  • There is no way to override system-wide access Settings on a per-file basis, which Apache can do with.htaccess files.

  • Poor support for the Window environment.

Web server selection: Nginx vs Apache

Apache is still popular as an old server, while Nginx is a new upstart with high performance, high concurrency and simple configuration.

Both of them have their own advantages and disadvantages, so you need to choose a server based on your own needs. If you want to improve the performance of static content, Nginx is better in most cases; In other cases Apache has an advantage because it is better suited to a shared hosting environment and has a control panel.

Nginx can also be used with Apache to its advantage: put Nginx in front of Apache as a reverse proxy, taking advantage of its ability to quickly and simultaneously process a large number of connections to handle all requests from clients.

If a request is for a static resource, Nginx can quickly process it back to the client. If it is a dynamic resource, Nginx will proxy the request to Apache to process and return the result, which will be returned to the client via Nginx.

The resources

Nginx

Nginx vs Apache

Nginx website