-
Notifications
You must be signed in to change notification settings - Fork 123
/
uwsgi.ini
65 lines (53 loc) · 2.27 KB
/
uwsgi.ini
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
[uwsgi]
strict = true
chdir = /opt/decider
module = decider:app
master = true
processes = 1
die-on-term = true
pyargv = --config KioskConfig
shared-socket = 0.0.0.0:443
uid = decider
gid = decider
https = =0,/opt/decider/config/certs/decider.crt,/opt/decider/config/certs/decider.key
# favicon via root or static
static-map = /favicon.ico=app/static/favicon.ico
static-map = /static/favicon.ico=app/static/favicon.ico
# rest of static assets
static-map = /static=app/static
static-expires = .* %(24 * 60 * 60)
; ; Disabled for now - Compression Enablement
; ; ----------------------------------------------------------------------------
; static-gzip-all = true
; offload-threads = 2
; # Apply conditional gzip encoding
; collect-header = Content-Type RESPONSE_CONTENT_TYPE
; collect-header = Content-Length RESPONSE_CONTENT_LENGTH
; # uWSGI internal are not that smart, thus no content-length means it's 0
; response-route-if = empty:${RESPONSE_CONTENT_LENGTH} goto:no-length
; # Don't bother compressing 1kb responses, not worth the trouble
; response-route-if = islower:${RESPONSE_CONTENT_LENGTH};1024 last:
; response-route-label = no-length
; # Make sure the client actually wants gzip
; response-route-if = contains:${HTTP_ACCEPT_ENCODING};gzip goto:check-response
; response-route-run = last:
; response-route-label = check-response
; # Don't bother compressing non-text stuff, usually not worth it
; response-route-if = equal:${RESPONSE_CONTENT_TYPE};application/json goto:apply-gzip
; response-route-if = startswith:${RESPONSE_CONTENT_TYPE};text/ goto:apply-gzip
; response-route-run = last:
; response-route-label = apply-gzip
; response-route-run = gzip:
; # Why apply this filter too you wonder? The gzip transformation is not smart
; # enough to chunk the body or set a Content-Length, thus keepalive will be broken
; response-route-run = chunked:
; # references / credits:
; # - https://blog.ionelmc.ro/2022/03/14/how-to-run-uwsgi/
; # - https://ugu.readthedocs.io/en/latest/compress.html
; ; ----------------------------------------------------------------------------
; Add / Remove Compressed Statics
; -------------------------------
; Compress Static
; find app/static/ -type f -not -name "*.gz" -exec gzip -9fk {} +
; Remove Archives
; find app/static/ -type f -name "*.gz" -exec rm {} +