upstream odoo { server 127.0.0.1:8090 weight=1 fail_timeout=0; } upstream odoo-im { server 127.0.0.1:8082 weight=1 fail_timeout=0; } server { # server port and name listen 80; server_name _; # Specifies the maximum accepted body size of a client request, # as indicated by the request header Content-Length. client_max_body_size 200m; ssl off; # increase proxy buffer to handle some Odoo web requests proxy_buffers 16 64k; proxy_buffer_size 128k; # force timeouts if the backend dies proxy_connect_timeout 180m; proxy_send_timeout 180m; proxy_read_timeout 180m; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; gzip on; gzip_min_length 1100; gzip_buffers 4 32k; gzip_types text/plain application/x-javascript text/xml text/css; gzip_vary on; # set headers proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; # by default, do not forward anything proxy_redirect off; proxy_buffering off; error_page 502 /custom_502.html; location = /custom_502.html { root /usr/share/nginx/html; internal; } location / { proxy_pass http://odoo; } location /longpolling { proxy_pass http://odoo-im; } # Cache some static data in memory for 2 hours. # Under heavy load this should relieve stress on the Odoo web interface location /web/static/ { proxy_cache_valid 200 120m; proxy_buffering on; expires 864000; proxy_pass http://odoo; } location /website/static/ { proxy_cache_valid 200 120m; proxy_buffering on; expires 864000; proxy_pass http://odoo; } }