How to quickly learn basic website construction and server environment configuration

Experiment 1: Deploy Tomcat server on Alibaba Cloud Click for details 

Business background

Tomcat is the server of the website. Each website has a server behind it to parse that webpage. Tomcat is a Servlet processor for Java. It supports running Servlet-based Java programs. At the same time, JSP itself is also based on Servlet technology. Supported, like the legendary Spring, Struts, JSF are all based on Servlet, can run on Tomcat.

technical background

Tomcat is a core project in the Jakarta project of the Apache Software Foundation, developed by Apache, Sun, and other companies and individuals. Thanks to Sun's participation and support, the latest Servlet and JSP specifications can always be reflected in Tomcat, and Tomcat 5 supports the latest Servlet 2.4 and JSP 2.0 specifications. Because Tomcat is advanced in technology, stable in performance, and free, it is loved by Java enthusiasts and recognized by some software developers, and it has become a popular Web application server.

The Tomcat server is a free and open source web application server. It is a lightweight application server. It is widely used in small and medium-sized systems and concurrent users. It is the first choice for developing and debugging JSP programs.

Experiment 2: Quickly build and deploy LAMP environment  Click for details

LAMP refers to the first letter of Linux (operating system), ApacheHTTP server, MySQL (sometimes also refers to MariaDB, database software) and PHP (sometimes refers to Perl or Python), generally used to build web application platforms. Although these open source programs are not specifically designed to work with several other programs, this combination has become popular due to their free and open source (most Linux distributions bundle these software). When used together, they behave like a dynamic solution package. Compared with the Java / J2EE architecture, LAMP has the characteristics of rich web resources, light weight, and rapid development. Compared with Microsoft's .NET architecture, LAMP has the advantages of universality, cross-platform, high performance, and low price. , Quality or price are the preferred platforms for companies to build websites.

Apache is the core Web Server of the LAMP architecture. Open source, stability, and rich modules are the advantages of Apache. However, the shortcomings of Apache are some bloat, large memory and CPU overhead, and loss of performance. It is not as efficient as some lightweight Web servers (such as nginx). The lightweight Web server's responsiveness to static files is much higher Apache server. Apache as the Web Server is the best choice for loading PHP. If the traffic is heavy, 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 supports load balancing and fault tolerance. It can be used with Apache and is the first choice for lightweight HTTP servers.

PHP acceleration uses eAccelerator accelerator, eAccelerator is a free open source PHP accelerator, optimization and dynamic content caching, improve the performance of PHP script cache performance, making PHP script almost completely eliminate the server overhead when compiled. It also optimizes the script to speed up its execution efficiency. Make PHP program code execution efficiency can increase 1-10 times.

Among the open source databases, MySQL is the first choice in terms of performance, stability, and functionality. It can reach millions of levels of data storage. MySQL and Web servers can be put together at the beginning of the website, but when the number of visits reaches a certain scale, MySQL should The database is independent from the Web Server and runs on a separate server, while maintaining a stable connection between the Web Server and the MySQL server.

Experiment 3: Deploy LNMP on Alibaba Cloud  Click for details

Introduction to LNMP

LNMP stands for: Nginx + MySQL + PHP this kind of website server architecture under Linux system.

Linux: It is a general term for a type of Unix computer operating system, and it is currently the most popular free operating system. Representative versions are: debian, centos, ubuntu, fedora, gentoo, etc.

Nginx: is a high-performance HTTP and reverse proxy server, but also an IMAP / POP3 / SMTP proxy server.

Mysql: is a small relational database management system.

PHP: is a scripting language embedded in HTML documents executed on the server side.

These four kinds of software are all free and open source software, which are combined together to become a free, efficient and highly scalable website service system.

Nginx introduction and usage scenarios

Nginx is a very lightweight HTTP server written by Russians. Nginx, pronounced "engine X", is a high-performance HTTP and reverse proxy server, and also an IMAP / POP3 / SMTP proxy server. Nginx was developed by Russian Igor Sysoev for the second most visited site in Russia, Rambler.ru, which has been running on the site for more than three years. Igor Sysoev used the BSD license when building the project.

Why is the performance of Nginx much higher than Apache? This is due to Nginx using the latest epoll (Linux 2.6 kernel) and kqueue (freebsd) network I / O model, while Apache uses the traditional select model. At present, Squid and Memcached, which can withstand high concurrent access under Linux, use the epoll network I / O model.

The select network I / O model used by Apache is very inefficient in handling a large number of connected reads and writes. Let's use a metaphor to analyze the difference between the select model used by Apache and the epoll model used by Nginx: Suppose you are studying at a university and there are many rooms in the dormitory, and your friends will come to you. The select version of the aunt will take your friends to find each room until you are found. The epoll version of the aunt will first write down the room number of each classmate. When your friend comes, you only need to tell your friend which room you live in. You do n’t have to take your friend to find someone in the building. If there are 10,000 people who come to find their classmates in this building, the select version and epoll version of the aunt, who is more efficient, it is self-evident. In the same way, polling I / O is one of the most time-consuming operations in high-concurrency servers. It is also very clear who selects and epoll performs better.

In the case of high concurrent connections, Nginx is a good alternative to the Apache server. Nginx can also be used as a 7-layer load balancing server. Nginx 0.8.46 + PHP 5.2.14 (FastCGI) can withstand more than 30,000 concurrent connections, which is equivalent to 10 times the Apache in the same environment.

Guess you like

Origin www.cnblogs.com/IT-Evan/p/12673973.html