Nginx first time

 1  ## Nginx

2
3 - Reverse proxy
4 > Reverse proxy mode means that the server receives internet link requests and then Converted to the internal web server according to the request
5 - Load balancing
6 1. Each request is allocated to the back-end server one by one in chronological order,
7 ``` Simple configuration
8 upstream test {
9 server localhost:8080;
10 server localhost:8081;
11
12 }
13
14 server {
15 listen 80;
16 server_name:localhost;
17
18 location / {
19 proxy_pass http://test;
20
21 }
22 }
23
24 ```
25
26 2 . Weight; specify the polling probability, weight is positively proportional to the access ratio, used for the unbalanced situation of the back-end server Xinneng
27
28 ```
29 upstream test {
30 server localhost:8080 weight=9;
31 server localhost:8081 weight=1;
32
33 }
34 //10 visits, 1 time 8081, 9 times 8080
35 ```
36
37 3 . When the ip_hash program request is not stateless (using session to save data), we need a client to access a server, and each request of ip_hash is allocated according to the hash result of the access ip so that each visitor fixes a back-end server
38
39 ```
40 upstream test {
41 ip_hash;
42 server localhost:8080 weight=9;
43 server localhost:8081 weight=1;
44
45 }
46 ```
47
48 4 . fair (third-party) According to the back-end response time to allocate the request response time short priority allocation
49 5. url_hash (third party) Assign requests according to the hash result of the visited url so that each url is directed to the same back-end server. Add a hash statement in the upstream server statement. Other parameters such as weight cannot be written in the server statement. hash_method uses hash Algorithm
50
51 ```
52 upstream test {
53 hash: $request_uri;
54 hash_method crc32;
55 server localhost:8080;
56 server localhost:8081;
57
58 }
59 ```
60
61 - HTPP server (dynamic and static separation)
62 Nginx itself is also a resource server, only for static resources You can use Nginx to act as a proxy while achieving dynamic and static separation
63
64 ```
65 server {
66 listen 80;
67 server_name:localhost;
68
69 location / {
70 root e:\html;
71 index index.html;
72 }
73 }
74 ```
75 > The index under the html directory of E disk will be accessed by default. html page
76
77
78 ```
79 server {
80 listen 80;
81 server_name:localhost;
82
83 location / {
84 root e:\html;
85 index index.html;
86 }
87
88 localhost ~ \.(gif|jpg|jpge)$ {
89 root e:\static;
90 }
91 }
92 ```
93 > All static files are processed by nginx, and the storage directory is html
94
95-Forward proxy

 1 ## Nginx

2
3 - Reverse proxy
4 > Reverse proxy mode means that the server receives internet link requests and then Converted to the internal web server according to the request
5 - Load balancing
6 1. Each request is allocated to the back-end server one by one in chronological order,
7 ``` Simple configuration
8 upstream test {
9 server localhost:8080;
10 server localhost:8081;
11
12 }
13
14 server {
15 listen 80;
16 server_name:localhost;
17
18 location / {
19 proxy_pass http://test;
20
21 }
22 }
23
24 ```
25
26 2 . Weight; specify the polling probability, weight is positively proportional to the access ratio, used for the unbalanced situation of the back-end server Xinneng
27
28 ```
29 upstream test {
30 server localhost:8080 weight=9;
31 server localhost:8081 weight=1;
32
33 }
34 //10 visits, 1 time 8081, 9 times 8080
35 ```
36
37 3 . When the ip_hash program request is not stateless (using session to save data), we need a client to access a server, and each request of ip_hash is allocated according to the hash result of the access ip so that each visitor fixes a back-end server
38
39 ```
40 upstream test {
41 ip_hash;
42 server localhost:8080 weight=9;
43 server localhost:8081 weight=1;
44
45 }
46 ```
47
48 4 . fair (third-party) According to the back-end response time to allocate the request response time short priority allocation
49 5. url_hash (third party) Assign requests according to the hash result of the visited url so that each url is directed to the same back-end server. Add a hash statement in the upstream server statement. Other parameters such as weight cannot be written in the server statement. hash_method uses hash Algorithm
50
51 ```
52 upstream test {
53 hash: $request_uri;
54 hash_method crc32;
55 server localhost:8080;
56 server localhost:8081;
57
58 }
59 ```
60
61 - HTPP server (dynamic and static separation)
62 Nginx itself is also a resource server, only for static resources You can use Nginx to act as a proxy while achieving dynamic and static separation
63
64 ```
65 server {
66 listen 80;
67 server_name:localhost;
68
69 location / {
70 root e:\html;
71 index index.html;
72 }
73 }
74 ```
75 > The index under the html directory of E disk will be accessed by default. html page
76
77
78 ```
79 server {
80 listen 80;
81 server_name:localhost;
82
83 location / {
84 root e:\html;
85 index index.html;
86 }
87
88 localhost ~ \.(gif|jpg|jpge)$ {
89 root e:\static;
90 }
91 }
92 ```
93 > All static files are processed by nginx, and the storage directory is html
94
95-Forward proxy

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4612 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.