-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnginx-docker.conf
More file actions
129 lines (111 loc) · 4.46 KB
/
nginx-docker.conf
File metadata and controls
129 lines (111 loc) · 4.46 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
# Specifies the main log format.
log_format frappe '{'
'"request_id": "$request_id",'
'"server_name": "$server_name",'
'"http_x_frappe_cmd": "$http_x_frappe_cmd",'
'"http_x_frappe_doctype": "$http_x_frappe_doctype",'
'"http_x_remote_addr": "$http_x_remote_addr",'
'"http_x_wr_server_name": "$http_x_wr_server_name",'
'"sent_http_x_remote_addr": "$sent_http_x_remote_addr",'
'"remote_addr": "$remote_addr",'
'"remote_user": "$remote_user",'
'"time_local": "$time_local",'
'"request": "$request",'
'"status": "$status",'
'"body_bytes_sent": $body_bytes_sent,'
'"http_referer": "$http_referer",'
'"http_user_agent": "$http_user_agent",'
'"http_x_forwarded_for": "$http_x_forwarded_for",'
'"request_time": $request_time,'
'"upstream_connect_time": $upstream_connect_time,'
'"upstream_header_time": $upstream_header_time,'
'"upstream_response_time": $upstream_response_time'
'}'
;
server {
listen 8000;
server_name site1.docker;
root /home/frappe/docker-bench/sites;
add_header X-Frame-Options "SAMEORIGIN";
# Sets the path, format, and configuration for a buffered log write.
access_log /home/frappe/docker-bench/logs/web_access.log frappe;
error_log /home/frappe/docker-bench/logs/web_error.log;
location /app-health {
#access_log off;
return 200 "healthy\n";
}
location /assets {
try_files $uri =404;
}
location ~ ^/protected/(.*) {
internal;
try_files /site1.docker/$1 =404;
}
location /socket.io {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Frappe-Site-Name site1.docker;
proxy_set_header Origin $scheme://$http_host;
proxy_set_header Host $host;
proxy_pass http://docker-bench-socketio-server;
}
location / {
try_files /site1.docker/public/$uri @webserver;
}
location @webserver {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frappe-Site-Name site1.docker;
proxy_set_header Host $host;
proxy_set_header X-Use-X-Accel-Redirect True;
proxy_read_timeout 120;
proxy_redirect off;
proxy_pass http://docker-bench-frappe;
}
# error pages
error_page 502 /502.html;
location /502.html {
root /usr/local/lib/python3.7/site-packages/bench/config/templates;
internal;
}
# optimizations
sendfile on;
keepalive_timeout 15;
client_max_body_size 50m;
client_body_buffer_size 16K;
client_header_buffer_size 1k;
# enable gzip compresion
# based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
gzip on;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/font-woff
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component
;
# text/html is always compressed by HttpGzipModule
}
upstream docker-bench-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}
upstream docker-bench-frappe {
server 127.0.0.1:8002 fail_timeout=0;
}