Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to treat the introduction to nginx

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about how to treat the introduction to nginx. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Introduction of 1.nginx

Ngin is the second largest Web server in the world, and more than 25% of them use Nginx to handle huge amounts of Internet requests. Nginx has become synonymous with high-performance Web servers in the industry.

Apache has many advantages, such as stability, open source, cross-platform and so on. On the Apache server, if tens of thousands of concurrent HTTP requests are accessed at the same time, a lot of memory will be consumed on the server, and hundreds of Apache processes within the operating system will also consume a lot of CPU resources for inter-process switching, and lead to a decrease in the average response speed of HTTP requests. All these determine that Apache can not become a high-performance Web server, which also promotes the emergence of nNginx.

Nginx can handle millions of TCP connections concurrently using an event-driven architecture.

Nginx is a cross-platform Web server that can run on Linux, FreeBSD, Solaris, AIX, Mac OS, Windows and other operating systems, and it can also use some efficient API unique to the current operating system to improve its performance.

two。 Why choose nginx?

(1) faster

On the one hand, under normal circumstances, a single request will get a faster response.

On the other hand, during peak periods (if there are tens of thousands of concurrent requests), nginx can respond to requests faster than other Web servers.

(2) High scalability

The design of Nginx is very scalable, it is completely composed of many modules with different functions, different levels, different types and very low coupling.

(3) High reliability

The high reliability of Nginx comes from the excellent design of its core framework code and the simplicity of module design.

(4) low memory consumption

In general, 10000 inactive HTTP Keep-Alive connections consume only 2.5MB memory in Nginx, which is the basis for Nginx to support highly concurrent connections.

(5) more than 100000 concurrent connections are supported on a single machine.

(6) Hot deployment

That is, the executable file of Nginx can be upgraded under the premise of 7 × 24-hour uninterrupted service. Of course, it also supports updating configuration items, changing log files, and so on without stopping the service.

(7) the freest BSD license agreement

The BSD license agreement not only allows users to use Nginx for free, it also allows users to directly use or modify Nginx source code in their own projects.

The core reason for choosing Nginx is that it can support highly concurrent requests while maintaining efficient services.

2. Installation of nginx

Just download the corresponding version from the official website [http://nginx.org/en/download.html]]. After the download is completed, you don't need to install it. Be careful that there are no Chinese paths.

Open cmd in the root directory of nginx and type start nginx to start nginx (note at this time, do not click nginx.exe to launch), there will be a black window flash for success or failure, so you can't see whether it is successful or not. You can use: http://localhost:80 to see if there is a successful prompt for nginx.

If the startup is successful, we can put our page in the nginx-> html folder and open it directly.

3. Common command

Start nginx starts nginxnginx-s reload reloads configuration file nginx-s quit closes nginx-s stop Quick close

The difference between quit and stop:

Quit completes received connection requests before shutting down

Stop shuts down quickly, regardless of connection

3. Modified port of nginx

Enter the conf-> nginx.conf configuration file

Note: after modifying the configuration file, remember to nginx-s reload before the configuration will take effect.

Introduction to 4.nginx

Nginx is a high-performance HTTP and reverse proxy service. Nginx is a powerful high-performance Web and reverse proxy service with many excellent features: Nginx is a good alternative to Apache services in the case of high concurrency connections.

4.nginx action

Http protocol agent

Build a virtual host

Reverse proxy of the service

Configure the load balancing of the cluster in the reverse proxy

6. Agency mode (1). Forward agent

Forward proxy, which means a server between the client and the original server (origin server). In order to get content from the original server, the client sends a request to the agent and specifies the target (the original server), and then the agent transfers the request to the original server and returns the obtained content to the client. Only clients can use forward proxies.

(2)。 Reverse proxy

Reverse proxy (Reverse Proxy) means that the proxy server accepts the connection request on the internet, then forwards the request to the server on the internal network, and returns the result obtained from the server to the client requesting the connection on the internet. At this time, the proxy server behaves as a reverse proxy server.

(3)。 The difference between the two

Different locations

Forward agent, set up between client and target host

Reverse proxy, set up on the server side

Different proxy objects

Forward agent, proxy client, server does not know the client that actually initiated the request

Reverse proxy, proxy server, the client does not know the server that actually provides the service

5.vue is packaged and deployed to nginx

Just copy all the files in the dist directory after vue packaging to the html directory under nginx.

After reading the above, do you have any further understanding of how to view the introduction to nginx? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report