-
Notifications
You must be signed in to change notification settings - Fork 2
/
.nginx
68 lines (55 loc) · 1.72 KB
/
.nginx
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
user root;
worker_processes 1;
error_log /var/log/nginx/error.log;
#请求量级大建议关闭acccess_log
#access_log /var/log/nginx/access.log main;
pid /var/run/nginx.pid;
events {
use epoll;
worker_connections 2048;
multi_accept on;
}
http {
charset utf-8;
client_max_body_size 75M;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# 提高静态文件的读写速度
sendfile on;
keepalive_timeout 300s;
client_header_timeout 300s;
client_body_timeout 300s;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
# 对所有 mime type 使用 gzip
gzip_types *;
gunzip on;
server {
listen 80;
location / {
root /usr/src/www;
index index.html index.htm;
# 后端支持前端路由由 hash 变为 history 的关键代码
try_files $uri $uri/ /index.html;
}
location /v1 {
include uwsgi_params;
uwsgi_pass 127.0.0.1:5000;
}
location /admin/ {
proxy_pass http://127.0.0.1:9001/;
# supervisor 有重定向,需要如下处理
proxy_redirect http://127.0.0.1:9001 /admin;
proxy_buffering off;
# supervisor logtail接口需要长连接,nginx 默认使用 http 1.0,无长连接
# https://www.hujiangtao.cn/2018/07/proxy-supervisor-log-with-nginx/#%E5%88%86%E6%9E%90
proxy_http_version 1.1;
# 保持keep-alive
proxy_set_header Connection "";
# 避免日志连接在 1 min内没有数据自动断开
proxy_read_timeout 600s;
proxy_send_timeout 600s;
}
}
}