linux-apache-mysql-php website Architecture Scheme Analysis _php Tutorial

Source: Internet
Author: User
Tags php website
The LAMP (linux-apache-mysql-php) website architecture is currently a popular international web framework that includes: Linux operating system, Apache Web server, MySQL database, Perl, PHP or Python programming language, All components are open source software, is an internationally mature architecture framework, many popular commercial applications are to adopt this architecture, and JAVA/J2EE architecture, lamp with rich web resources, lightweight, rapid development features, Microsoft's. NET architecture, lamp has a common, cross-platform, high-performance, low-cost advantages, so lamp whether it is performance, quality or price is the preferred platform for enterprises to build websites.

For large-traffic, large-volume Web site system architecture, in addition to the use of high-performance hardware server, load Balancing, CDN, and so on, the software architecture needs to focus on the following aspects: the use of high-performance operating system (OS), high-performance Web server (Web servers), High-performance Database (DATABSE), high-efficiency programming language, etc. Below I will discuss one by one of them from these points.

Operating system

Linux operating systems have many different distributions, such as Red Hat Enterprise Linux, SUSE Linux enterprice, Debian, Ubuntu, CentOS, etc., each of which has its own features, such as the stability of Rhel, Ubuntu is easy to use, based on stability and performance considerations, operating System selection of CentOS (Community ENTerprise Operating system) is an ideal solution.

CentOS (Community ENTerprise Operating System) is one of the Linux distributions and is the Lite free version of rhel/red Hat ENTerprise Linux, and Rhel for the same source code, however, For enterprise editions such as Rhel and SuSE le, upgrades are available for a fee upgrade and cannot be upgraded online free of charge, so a server that requires free, highly stable servers can be used with CentOS instead of Red Hat Enterprise Linux.

Lamp website Architecture diagram

Web server, cache, and PHP acceleration

Apache is the core of the lamp architecture Web Server, open source, stable, module Rich is the advantage of Apache. But the disadvantage of Apache is a bit bloated, memory and CPU overhead, performance loss, as some lightweight Web servers (such as nginx) efficient, lightweight Web server for the static file responsiveness is much higher than the Apache server.

Apache as Web server is the best choice to load PHP, if the traffic is very large, you can use Nginx to load non-PHP Web requests. Nginx is a high-performance HTTP and reverse proxy server, Nginx is known for its stability, rich feature set, sample configuration files and low system resource consumption. Nginx does not support dynamic languages such as PHP and CGI, but it supports load balancing and fault tolerance, which can be used with Apache and is the preferred choice for lightweight HTTP servers.

Web Server cache also has a variety of scenarios, Apache provides its own cache module, you can also use the addition of Squid module for caching, both of which can effectively improve the access response of Apache. Squid cache is a Web cache server that supports efficient caching and can be used as cache-related requests by the Web server's front cache server to increase the speed of the Web server, placing squid on Apache's front-end to cache Web server-generated dynamic content. Web applications only need to set the page's actual time appropriately. Consider using Memcache as a distributed cache, such as a large number of accesses.

PHP acceleration using the Eaccelerator Accelerator, Eaccelerator is a free open source PHP accelerator, optimized and dynamic content caching, improving performance of PHP script cache performance, so that PHP script in the state of compilation, the cost of the server almost completely eliminated. It also has the effect of optimizing the script to speed up its execution efficiency. Increase the efficiency of PHP program code by up to 1-10 times.

Specific solutions are available in the following ways:

1, squid + Apache + PHP + eaccelerator

Using Apache payload PHP, using squid for caching, HTML or picture requests can be returned directly from squid to the user. This architecture is used by many large websites.

2, Nginx/apache + PHP (fastcgi) + eaccelerator

Use the Nginx or Apache load php,php to run with fastcgi, which is highly efficient.

3, Nginx + Apache + PHP + eaccelerator

This scheme combines the advantages of nginx and Apache, uses Apache load Php,nginx to parse other Web requests, uses Nginx rewrite module, Apache port is not open to the outside.

Database

Open source database, MySQL in performance, stability and functionality is the first choice, can achieve millions of data storage, the site can initially put MySQL and Web server together, but when the traffic reached a certain scale, the MySQL database should be independent from the Web server, Run on a separate server while maintaining a stable connection between the Web server and the MySQL server.

When database traffic reaches a higher level, consider using a solution such as a DB cluster such as MySQL cluster or a library table hash.

Overall, the lamp architecture site performance will be much better than the Windows IIS + ASP + access (such as Moonlight blog) Such a site, can load the traffic is also very large, domestic large number of personal sites if you want to support large traffic, the use of lamp architecture is a good solution.

In summary, based on lamp architecture design with low cost, flexible deployment, rapid development, security and stability characteristics, is a good combination of Web application and environment.

http://www.bkjia.com/PHPjc/735139.html www.bkjia.com true http://www.bkjia.com/PHPjc/735139.html techarticle LAMP (linux-apache-mysql-php) website architecture is a popular international web Framework, which includes: Linux operating system, Apache Web server, MySQL database, Perl, PHP or Pytho ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.