LAMP and LNMP Architecture Analysis

LAMP and LNMP Architecture Analysis

LAMP = Linux + Apache + MySQL +PHP
LNMP = Linux + Nginx + MySQL +PHP

LAMP and LNMP are a group of open source software commonly used to build dynamic websites or servers. They are independent programs, but because they are often used together, they have higher and higher degrees of compatibility, and together they form a powerful Web application platform.

The above two architectures are the current mainstream architectures of websites. The
main difference between LAMP and LNMP is that one uses Apache and the other uses Nginx.

Linux open source free software, as the operating system of the website
Apache/Nginx Web server software
MySQL multi-threaded multi-user database management system, used to store data
PHP server-side application software, fast execution of dynamic web pages


Compared with nginx, Apache
is a bit bloated, with large memory and CPU overhead, and loss in performance. nginx's responsiveness to static files is much higher than apache.
Apache is the best choice for loading PHP, and if you have a lot of traffic, you can use nginx to load non-PHP web requests.

Nginx
Nginx is a high-performance Http and reverse proxy server, as well as an AMAP/POP3/SMTP server. Compared with Apache, nginx uses less resources, supports more concurrent connections, and is more efficient. It acts as a load balancing server. nginx can support both internal and external services. It is also a very good mail proxy server with simple installation and brief configuration.
Compared with Apache, using Nginx as a web server: it uses less resources, supports more concurrent connections, and is more efficient. As a load balancing server: Nginx can directly support Rails and PHP internally, and can also support external services as an HTTP proxy server. As a mail proxy server: Nginx is also a very good mail proxy server (one of the earliest purposes of developing this product was to act as a mail proxy server). The reverse proxy can redirect requests to clusters for different purposes according to the URL, such as image requests, to image server clusters; video requests, to video server clusters. Nginx is a lightweight web server/reverse proxy server/email proxy server, which is very easy to install, and the configuration file is very concise (also supports perl syntax). Nginx supports smooth loading of new configurations, as well as software version upgrades with uninterrupted service.

To sum up:
Advantages of LNMP: It occupies less VPS resources, and Nginx is relatively simple to configure. It uses fast-cgi to dynamically parse PHP scripts.

Disadvantages of the LNMP method: The load capacity of the php-fpm component is limited. When the traffic volume is huge, the php-fpm process is easy to freeze, and the 502 bad gateway error is prone to occur.

LAMP-based architecture design has the characteristics of low cost, flexible deployment, rapid development, security and stability, etc. It is an excellent combination of Web network applications and environments. If the server configuration is relatively low personal website, of course, the preferred LNMP architecture.
Of course, when there is a lot of traffic. Combining Apache and Nginx is also a good choice, as follows:

LNAMP is a combination of Linux+Nginx+Apache+Mysql+PHP. It is characterized by using Nginx as the parsing of static scripts, and using the forwarding feature of Nginx to transfer the parsing of dynamic scripts to Apache for processing. In this way, it can make full use of The characteristics of the two Web servers are a very good choice for sites with large traffic demands.

Advantages of the LNAMP method: Since Apache itself has a stronger ability to handle PHP than php-fpm, errors like 502 bad gateway are not prone to occur. It is suitable for sites with a large number of visits.

Disadvantages of the LNAMP method: Compared with the LNMP method, it will take up more resources. In addition, configuring the virtual host needs to modify the configuration files of Nginx and Apache at the same time, which is a little more troublesome.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324528639&siteId=291194637