I. Web server
- The Web server is the backbone of any Internet activity and the choice of the right server type.
- It will be the advantage that makes the difference between a successful application with a great response speed and an application with a slow processing speed (lag), which brings a bad experience for users.
- Therefore, understanding your needs is an important task to choose the right server and respond well to the problems posed.
1. What is Nginx?
- NGINX, pronounced engine-X is a commonly used web server with double proxies, load balancers and HTTP buffers for HTTP, TCP and UDP servers. Designed by Igor Sysoev in 2004.
- This web server is designed as a way to overcome the C10k problem.
- NGINX is an open software, but also offers a paid package and is currently running on a variety of environments including variants of Unix, Linux, BSD, MacOS, Solaris, AIX, HP-UX and Windows.
- Sysoev’s goal when creating this web server is to create the fastest web server around, and the community is always trying to maintain this goal.
- It beats other web servers in web server performance benchmark.
- As the websites became more dynamic, NGINX followed suit.
- From simple HTML pages to dynamic web pages, NGINX supports all components of modern Web, including WebSocket, HTTP / 2 and streaming many video formats (HDS, HLS, RTMP and other formats). other).
2. C10k Problem
- When the internet was young, scaling was such a big problem.
- However, as the internet evolved into a major support tool for business and connecting people on the web, scaling became one of the major issues that needed to be addressed.
- The main problem web servers often face is the heavy load, when more connections are needed, the web server will slow down.
- This was a Dan Kegel C10k issue in 1999, referring to Simtel’s FTP server, cdrom.com , which served 10,000 customers simultaneously on 1 Gigabit Ethernet in that year.
- Although, servers are more equipped to handle many loads today, the problem that many web servers still encounter is the processing of more requests per second, reducing request processing speed.
- NGINX uses a more scalable (asynchronous) event-driven architecture, instead of relying on a thread-based request processing system, which handles more requests per second without affecting speed. .
3. Functions of Nginx
- Low memory footprint
- Ability to handle more than 10,000 simultaneous connections
- Handling of static files, index files and auto-indexing
- Reverse proxy with caching
- Load balancing
- Name-based and IP-based virtual servers
- The PUT, DELETE, MKCOL, COPY, and MOVE methods
- FLV and MP4 streaming
- Response rate limiting
- Limiting the number of simultaneous connections or requests coming from one address
- Embedded Perl
These are just some of the features of NGINX, you can check out all the features of nginx here .
4. LEMP Stack
- LEMP is an anagram that defines a group of software used to start and run the server.
- The stack consists of the following four software: Linux, NGINX (pronounced engine-X) MySQL and PHP.
- The LEMP stack is a variant of the famous LAMP stack, but replaced Apache with a light and powerful NGINX, preserving the rest of the stack.
5. Differences between LEMP and LAMP
- As stated above, the only difference between the LAMP stack and LEMP is the web server.
- While LAMP uses Apache web server software for its applications, LEMP uses NGINX for its own stack.
- Apache has dominated server technology for a long time and has played an important role in the early development of the World Wide Web, but slowly and slowly, compared to NGINX and Varnish, when it comes to delivering static pages. .
- However, in series 2.4, Apache sought to compete directly with event-based web servers. You can learn about the basics of Apache in this tutorial.
- Currently, LAMP stacks are more common when building websites. However, LEMP is closely following for developers who want a fast and low footprint web server.
6. Apache vs NGINX
- Apache and NGINX can be considered two sides of the coin, with both providing the same ultimate goal with different means.
- Apache and NGINX are both excellent software for building powerful and dynamic websites.
- While both Apache and NGINX are great software for building web servers, Apache is more suited to the functionality of heavy applications and websites, while NGINX is faster and can handle higher loads.
- NGINX also provides other functions such as reverse proxy, load balancing and HTTP buffers, creating a powerful software to have on hand.