-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathnginx.conf
More file actions
137 lines (112 loc) · 3.79 KB
/
nginx.conf
File metadata and controls
137 lines (112 loc) · 3.79 KB
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
user nginx;
error_log /kiworkshop/logs/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 1024;
}
http {
include /etc/nginx/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" $request_time '
'$upstream_response_time "$upstream_addr" "$http_x_forwarded_for" '
'$upstream_cache_status';
include conf.d/*.conf;
map $http_upgrade $connection_upgrade {
default "upgrade";
}
upstream monolith {
server 127.0.0.1:8080;
keepalive 1024;
}
upstream auth {
server 127.0.0.1:8081;
keepalive 1024;
}
upstream frontend {
server 127.0.0.1:3000;
keepalive 1024;
}
server {
listen 80 default_server;
root /usr/local/community/admin;
index index.html;
autoindex off;
location / {
proxy_pass http://frontend;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /api {
rewrite ^/api/(.*) /$1 break;
proxy_pass http://monolith;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /api/users {
rewrite ^/api/(.*) /$1 break;
proxy_pass http://auth;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /api/oauth {
rewrite ^/api/(.*) /$1 break;
proxy_pass http://auth;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /gglogin.html {
proxy_pass http://auth;
}
# admin
location /admin {
# https://stackoverflow.com/a/38026037
if (!-e $request_filename){
rewrite ^/admin /index.html break;
rewrite ^/admin/(.*) /$1/index.html break;
}
}
location ~* /admin.*\.(?:html?|xml|json)$ {
rewrite ^/admin/(.*) /$1 break;
expires -1;
}
location ~* /admin.*\.(?:css|js)$ {
rewrite ^/admin/(.*) /$1 break;
expires 1d;
access_log off;
add_header Cache-Control "public";
}
# Log
access_log /kiworkshop/logs/nginx/access.log main;
server_tokens off;
client_body_buffer_size 8K;
client_header_buffer_size 1k;
large_client_header_buffers 4 32k;
client_header_timeout 60;
client_body_timeout 60;
keepalive_timeout 60;
send_timeout 60;
gzip on;
gzip_comp_level 4;
}
}