forked from svseas/merctrans-odoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
odoo-nginx.conf
58 lines (49 loc) · 1.7 KB
/
odoo-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
# Define a server for odoo backend (port 8069, as configured on the odoo.conf file (odoo file) )
upstream odoo-backend {
server web:8069;
}
# Define a server for longpolling (port 8072, as configured on the odoo.conf file (odoo file) )
upstream odoo-lp{
server web:8070;
}
server {
listen 8069;
server_name moron.merctrans.vn;
rewrite ^(.*) https://$host$1 permanent;
# Log files
access_log /var/log/nginx/odoo-access.log;
error_log /var/log/nginx/odoo-error.log;
# Increase proxy buffer size
proxy_buffers 16 64k;
proxy_buffer_size 128k;
# Force timeouts if the backend dies
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# Enable data compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain text/xml text/css text/less application/x-javascript application/xml application/json application/javascript;
gzip_vary on;
# Proxy header and settings
proxy_set_header Host $http_host;
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;
# Cache static data
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo-backend;
}
location / {
proxy_pass http://odoo-backend;
# The following makes the timeout broader
proxy_read_timeout 30000;
proxy_redirect off;
}
location /longpolling {
proxy_pass http://odoo-lp;
proxy_read_timeout 30000;
}
}