#
|
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;
|
}
|
}
|
|
|
}
|