-
Notifications
You must be signed in to change notification settings - Fork 5
/
inventree_nginx.conf
115 lines (100 loc) · 2.99 KB
/
inventree_nginx.conf
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
# MODIFY SECTIONS IF USING NGINX FOR SSL
# https://nginx.org/en/docs/ngx_core_module.html
user nginx;
worker_processes ${NGINX_WORKER_PROCESSES};
worker_rlimit_nofile ${NGINX_WORKER_RLIMIT_NOFILE};
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
multi_accept on;
worker_connections ${NGINX_WORKER_CONNECTIONS};
}
# https://nginx.org/en/docs/http/ngx_http_core_module.html
http {
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
log_not_found off;
types_hash_max_size 2048;
types_hash_bucket_size 64;
keepalive_timeout 65s;
# MIME
include /etc/nginx/mime.types;
default_type application/octet-stream;
# https://nginx.org/en/docs/http/ngx_http_log_module.html
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
# https://nginx.org/en/docs/http/ngx_http_upstream_module.html
upstream inventree {
server inventree:8000;
}
# https://nginx.org/en/docs/http/ngx_http_ssl_module.html
# https://nginx.org/en/docs/http/configuring_https_servers.html
# UNCOMMENT IF USING NGINX FOR SSL
# server {
# listen 80;
# listen [::]:80;
# server_name ${NGINX_HOST};
# return 301 https://$host$request_uri;
# }
server {
# COMMENT IF USING NGINX FOR SSL
listen 80;
listen [::]:80;
# UNCOMMENT IF USING NGINX FOR SSL
# listen 443 ssl http2;
# listen [::]:443 ssl http2;
# ssl_certificate /etc/nginx/certs/${NGINX_SSL_CERT};
# ssl_certificate_key /etc/nginx/certs/${NGINX_SSL_KEY};
# https://nginx.org/en/docs/http/server_names.html
server_name ${NGINX_HOST};
# max file upload size
client_max_body_size ${NGINX_CLIENT_MAX_BODY_SIZE};
client_body_timeout ${NGINX_CLIENT_BODY_TIMEOUT};
# https://nginx.org/en/docs/http/ngx_http_gzip_module.html
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 256;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/json
application/javascript
application/x-javascript
application/xml
application/rss+xml
application/atom+xml
image/svg+xml;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_redirect off;
proxy_pass http://inventree;
expires -1;
}
location /static/ {
alias /var/www/inventree/static/;
expires max;
access_log off;
add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate";
}
location /media/ {
autoindex on;
alias /var/www/inventree/media/;
expires max;
access_log off;
add_header Cache-Control "no-cache, public, must-revalidate, proxy-revalidate";
}
}
}