Get the App
SLTechnology News&Howtos  ›  Servers  › 

Nginx installation-reverse proxy-load balancing-static and dynamic separation

Shulou Source: shulou.com Published: 2022-06-03 10:15:27 10月03日 Update

Installation

1. Need material

The last two download and install with the command

Openssl-1.0.1t.tar.gz

Zlib-1.2.8.tar.gz

2: put the two files "nginx-1.16.1.tar.gz" and "pcre-8.37.tar.gz" in / usr/src/ and extract them.

Then under the pcre-8.37 file, first:. / configure is typing make & & make install

Pcre-conffig-- verison view version

Next, install nginx to enter nginx-1.16.1. / configure is knocking on make & & make install

After the installation is complete, there is an extra local/nginx in usr, and there is sbin and startup script in nginx

. / nginx start

. / nginx-s reload restart

. / nginx-s stop is forced to close and may not save things; quit

. / nginx-v check the version number

Reverse proxy

Load balancing

Dynamic and static separation

In Web development, generally speaking, dynamic resources actually refer to those background resources, while static resources refer to files such as HTML,JavaScript,CSS,img.

Generally speaking, it is necessary to separate dynamic resources from static resources and deploy static resources on Nginx. When a request comes, if it is a request for static resources, it will go directly to the static resource directory configured by nginx to obtain resources. If it is a request for dynamic resources, nginx uses the principle of reverse proxy to forward the request to the background application for processing, so as to achieve static and dynamic separation.

After using the front-end separation, the access speed of static resources can be greatly improved. At the same time, in the opening process, the front-end development parallel can effectively improve the development time, and some can reduce the co-tuning time.

I have a simple configuration here.

First create a folder / data/ under the root directory, and then create two files image and www below

Text

Then we go to the / usr/local/nginx/conf directory

Edit nginx.conf

Then restart nginx

Visit

Text

The last omission

Tags: Resources static files two dynamic development movement agent background that is text time version directory configuration balanced large efficient generally speaking things Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Tech Info Shulou Information NVidia Xiaomi