chen.lin
18 小时以前 efe0972ca3e0f816bc274c4e579d61763ac2adcf
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
# Windows Nginx 主配置文件
 
worker_processes  auto;
 
error_log  logs/error.log notice;
pid        logs/nginx.pid;
 
events {
    worker_connections  2048;
}
 
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"';
 
    log_format api_log '$remote_addr - $remote_user [$time_local] '
                       '"$request_method $request_uri HTTP/$server_protocol" '
                       '$status $body_bytes_sent "$http_referer" '
                       '"$http_user_agent" "$http_x_forwarded_for" '
                       'request_time="$request_time" '
                       'upstream_response_time="$upstream_response_time" '
                       'request_length="$request_length"';
 
    log_format json_log '$remote_addr - $remote_user [$time_local] '
                        '"$request_method $request_uri HTTP/$server_protocol" '
                        '$status $body_bytes_sent '
                        '"$http_referer" "$http_user_agent" '
                        '"$http_x_forwarded_for" '
                        'request_body="$request_body" '
                        'content_type="$content_type" '
                        'request_time="$request_time" '
                        'upstream_response_time="$upstream_response_time"';
 
    # 全局日志(server 中可覆盖)
    access_log  logs/access.log  main;
    error_log   logs/error.log error;
 
    # 全局配置
    client_max_body_size 300M;
    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;
    keepalive_timeout  65;
 
    # Gzip 压缩
    gzip  on;
    gzip_vary on;
    gzip_min_length 1000;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
 
    # 后端服务器配置
    upstream api_backend {
        server 127.0.0.1:8081;
    }
    
    upstream server_backend {
        server 127.0.0.1:8085;
    }
 
    # 引入 server 配置
    include conf.d/*.conf;
}