mayisheng
2022-08-01 a06c24c96558eb39e9e24537ad4b61a98a487fad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#
user nobody;
worker_processes 8;
 
#
error_log logs / error.log;#
error_log logs / error.log notice;#
error_log logs / error.log info;
 
#
pid logs / nginx.pid;
 
 
events {
    worker_connections 50000;
}
 
 
http {
    include mime.types;
    default_type application / octet - stream;
 
    #
    log_format main '$remote_addr - $remote_user [$time_local] "$request" '#
    '$status $body_bytes_sent "$http_referer" '#
    '"$http_user_agent" "$http_x_forwarded_for"';
 
    #
    access_log logs / access.log main;
 
    sendfile on;#
    tcp_nopush on;
 
    #
    keepalive_timeout 0;
    keepalive_timeout 65;
 
    #
    gzip on;
    gzip on;#
    表示开启压缩功能
    gzip_min_length 1 k;#
    表示允许压缩的页面最小字节数, 页面字节数从header头的Content - Length中获取。 默认值是0, 表示不管页面多大都进行压缩, 建议设置成大于1K。 如果小于1K可能会越压越大
    gzip_buffers 4 32 k;#
    压缩缓存区大小
    gzip_http_version 1.1;#
    压缩版本
    gzip_comp_level 6;#
    压缩比率, 一般选择4 - 6, 为了性能gzip_types text / css text / xml application / javascript;#
    指定压缩的类型 gzip_vary on;#
    vary header支持
    upstream gateway {
        server localhost: 80;
 
    }
 
    server {
        listen 83;
        server_name localhost;
        root C: \Software\\ nginx - 1.20 .2\\ nginx - 1.20 .2\\ project\\ dist;#
        charset koi8 - r;
 
        #
        access_log logs / host.access.log main;
 
        location / {}
 
 
        location ^ ~/api {
        proxy_set_header Host $host;
        proxy_set_header X - Real - IP $remote_addr;
        proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for;
        proxy_buffering off;
        rewrite ^ /api/(.*) $ / $1
        break;
        proxy_pass http: //gateway;
    }
 
}
server {
    listen 85;
    server_name localhost;
    root C: \Software\\ nginx - 1.20 .2\\ nginx - 1.20 .2\\ project\\ zhsq;#
    charset koi8 - r;
 
    #
    access_log logs / host.access.log main;
 
    location / {}
 
 
    location ^ ~/api {
    proxy_set_header Host $host;
    proxy_set_header X - Real - IP $remote_addr;
    proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for;
    proxy_buffering off;
    rewrite ^ /api/(.*) $ / $1
    break;
    proxy_pass http: //localhost:82;
}
 
}
 
server {
    listen 84;
    server_name localhost;
    root C: \Software\\ nginx - 1.20 .2\\ nginx - 1.20 .2\\ projectzhxy\\ dist;
 
    gzip on;
    gzip_http_version 1.0;#
    gzip支持http协议-- - 由于默认是1 .1, 但是匹配的是1 .0, 所以需要设置为1 .0 才能正常使用gzip
 
    gzip_static on;
    gzip_proxied expired no - cache no - store private auth;
    gzip_disable "MSIE [1-6]\.";
    gzip_vary on;
 
    gzip_types text / plain application / x - javascript application / javascript text / css application / xml text / javascript image / jpeg image / gif image / png;#
    gzip_static on;
 
    #
    charset koi8 - r;
 
    #
    access_log logs / host.access.log main;
 
    location / {}
    location ^ ~/api {
    proxy_set_header Host $host;
    proxy_set_header X - Real - IP $remote_addr;
    proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for;
    proxy_buffering off;
    rewrite ^ /api/(.*) $ / $1
    break;
    proxy_pass http: //localhost:82;
}
}
server {
    listen 86;
    server_name localhost;
    root C: \Software\\ nginx - 1.20 .2\\ nginx - 1.20 .2\\ projectzhxy\\ zhxy;
 
    gzip on;
    gzip_min_length 1 k;
    gzip_comp_level 9;
    gzip_types text / plain application / javascript application / x - javascript text / css application / xml text / javascript application / x - httpd - php image / jpeg image / gif image / png;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";
    location / appShare {
        client_max_body_size 10 m;
        root / home / test / webIndex / appShare;
        try_files $uri $uri / /appShare/index.html;
        index index.htm index.html;
    }
}
server {
    listen 90;
    server_name localhost;
    root C: \Software\\ nginx - 1.20 .2\\ nginx - 1.20 .2\\ zhny\\ dist;
 
    gzip on;
    gzip_http_version 1.0;#
    gzip支持http协议-- - 由于默认是1 .1, 但是匹配的是1 .0, 所以需要设置为1 .0 才能正常使用gzip
 
    gzip_static on;
    gzip_proxied expired no - cache no - store private auth;
    gzip_disable "MSIE [1-6]\.";
    gzip_vary on;
 
    gzip_types text / plain application / x - javascript application / javascript text / css application / xml text / javascript image / jpeg image / gif image / png;#
    gzip_static on;
 
    #
    charset koi8 - r;
 
    #
    access_log logs / host.access.log main;
 
    location / {}
    location ^ ~/api {
    proxy_set_header Host $host;
    proxy_set_header X - Real - IP $remote_addr;
    proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for;
    proxy_buffering off;
    rewrite ^ /api/(.*) $ / $1
    break;
    proxy_pass http: //localhost:89;
}
}
 
 
}