Home >Backend Development >PHP Problem >Which servers can php be deployed to?

Which servers can php be deployed to?

青灯夜游
青灯夜游Original
2022-06-30 14:58:544243browse

php can be deployed on 2 types of web servers: 1. apache, an open source web server of the Apache Software Foundation, can run on most computer operating systems, due to its multi-platform and security It is widely used; 2. nginx is a high-performance HTTP and reverse proxy web server, and also provides "IMAP/POP3/SMTP" services.

Which servers can php be deployed to?

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, DELL G3 computer

Commonly used web servers for php are generally Two types:

  • apache

  • nginx

LAMP (linux apache mysql php ) and LNMP (linux ngnix mysql php) are currently the most commonly used PHP environment architectures for servers.

apache server

Apache HTTP Server (referred to as Apache) is an open source web server of the Apache Software Foundation that can be used on most It runs on computer operating systems and is widely used due to its multi-platform and security features. It is one of the most popular web server-side software. It is fast, reliable and extensible through a simple API to compile interpreters such as Perl/Python into the server.

Apache is a popular open source, cross-platform web server, and it is also the most popular web server in existence.

Apache HTTP server is a modular server, derived from NCSAhttpd server. After many modifications, it has become the world's number one web server software.

It can run on almost all widely used computer platforms.

Apache originated from the NCSAhttpd server. After many modifications, it has become one of the most popular web server software in the world. Apache is taken from the pronunciation of "a patchy server", which means a server full of patches. Because it is free software, people are constantly developing new functions and features for it, and modifying the original defects. Apache is characterized by simplicity, fast speed, stable performance, and can be used as a proxy server.

Originally it was only used for small or experimental Internet networks, and later gradually expanded to various Unix systems, especially the support for Linux is quite perfect. Apache has a variety of products that can support SSL technology and multiple virtual hosts. Apache is a process-based structure. Processes consume more system overhead than threads and are not suitable for multi-processor environments. Therefore, when expanding an Apache website, it is usually necessary to add servers or expand cluster nodes instead of increasing processor. So far, Apache is still the most used web server in the world, with a market share of about 60%. Many famous websites in the world such as Amazon, Yahoo!, W3 Consortium, Financial Times, etc. are products of Apache. Its success mainly lies in its open source code, an open development team, and support for cross-platform applications ( It can run on almost all Unix, Windows, and Linux system platforms) and its portability.

The birth of Apache is very dramatic. When the NCSAWWW server project came to a halt, those using the NCSAWWW server began exchanging patches for the server, and they quickly recognized the need for a forum to manage these patches. In this way, the Apache Group was born, which later created Apache based on NCSA.

Apache web server software has the following features:

1. Supports the latest HTTP/1.1 communication protocol

2. Has a simple and powerful based on File configuration process

3.Support universal gateway interface

4.Support IP-based and domain name-based virtual hosts

5.Support multiple methods of HTTP authentication

6. Integrated Perl processing module

7. Integrated proxy server module

8. Supports real-time monitoring of server status and customized server logs

9. Supports server side Contains instructions (SSI)

10. Supports Secure Socket Layer (SSL)

11. Provides tracking of user session processes

12. Supports FastCGI

13. JavaServlets can be supported through third-party modules

If you are ready to choose a Web server, there is no doubt that Apache is your best choice.

nginx server

Nginx (engine x) is a high-performance HTTP and reverse proxy web server, and also provides IMAP/ POP3/SMTP service. Nginx was developed by Igor Sesoev for the Rambler.ru site (Russian: Рамблер), the second most visited site in Russia. The public version 1.19.6 was released on December 15, 2020.

It releases source code under a BSD-like license and is known for its stability, rich feature set, simple configuration files and low system resource consumption. On January 25, 2022, nginx 1.21.6 was released.

Nginx is a lightweight web server/reverse proxy server and email (IMAP/POP3) proxy server, released under the BSD-like protocol. Its characteristics are that it occupies less memory and has strong concurrency capabilities. In fact, nginx's concurrency capabilities perform better among web servers of the same type.

Nginx can be compiled and run on most Unix Linux OS, and there is a Windows ported version. The 1.20.0 stable version of Nginx has been released on April 20, 2021. Under normal circumstances, for new sites, it is recommended to use the latest stable version as the production version. The urgency of upgrading existing sites is not high. Nginx's source code uses a 2-clause BSD-like license.

Nginx is a very powerful, high-performance Web and reverse proxy service. It has many very superior features:

In the case of high concurrency of connections, Nginx is a good alternative to the Apache service. Product: Nginx is one of the software platforms often chosen by bosses in the virtual host business in the United States. Able to support responses of up to 50,000 concurrent connections. Thanks to Nginx for choosing epoll and kqueue as the development model.

What is the difference between apache and nginx:

1. The core difference between the two is that apache is a synchronous multi-process model. A connection corresponds to a process; nginx is asynchronous, and multiple connections can correspond to a process. nginx handles static files well and consumes less memory. But there is no doubt that apache is still the current mainstream and has many rich features, so it still needs to be matched. Of course, if it is determined that nginx meets the needs, then using nginx will be a more economical way.

2. The load capacity of nginx is much higher than that of apache. The latest server also uses nginx. And after changing the configuration of nginx, you can -t test whether there is any problem with the configuration.

3. When apache is restarted and it is found that the configuration is wrong, it will crash. When making changes, you will be very careful. Now there are many cluster sites, the front-end nginx anti-concurrency, the back-end apache cluster, the cooperation is also good.

4. It is useless for nginx to handle dynamic requests. Generally, apache is required to handle dynamic requests. nginx is only suitable for static and reverse requests.

5. From experience, nginx is a very good front-end server with good load performance. With nginx, it is effortless to use webbench to simulate 10,000 static file requests. Apache has good support for languages ​​​​such as php. In addition, apache has a strong support network. It has been developed longer than nginx and has fewer bugs. However, apache has the disadvantage of not supporting multi-core processing loads. It is recommended to use nginx for the front end and back end. apache. For large websites, it is recommended to use the cluster function of nginx.

6. In most cases, nginx is better than APACHE, such as static file processing, PHP-CGI support, reverse proxy function, front-end Cache, connection maintenance, etc. In Apache PHP (prefork) mode, if PHP processing is slow or the front-end pressure is high, it is easy for the number of Apache processes to surge, resulting in a denial of service.

7. Apache has advantages in processing dynamics. Nginx has better concurrency and low CPU memory usage. If rewrite is frequent, then Apache is the best!

8. Generally speaking, for web services that require performance, use nginx. If you don't need performance and just want stability, then use apache.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of Which servers can php be deployed to?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn