Skip to content

Instantly share code, notes, and snippets.

@mga-odoo
Created January 29, 2016 13:27
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save mga-odoo/973b5cab56261137bab8 to your computer and use it in GitHub Desktop.
Save mga-odoo/973b5cab56261137bab8 to your computer and use it in GitHub Desktop.
Odoo Proxy Server Configuration on Nginx
upstream odoo-server {
server 0.0.0.0:8069;
}
upstream odoo-server-im {
server 0.0.0.0:8072 weight=1 fail_timeout=0;
}
server {
listen 80;
server_name odoo.com
alias *.odoo.com
alias *.openerp.com
alias *.tinyerp.com;
# Specifies the maximum accepted body size of a client request,
# as indicated by the request header Content-Length.
client_max_body_size 200m;
# ssl log files
access_log /var/log/nginx/odoo-access.log;
error_log /var/log/nginx/odoo-error.log;
# add ssl specific settings
keepalive_timeout 90;
# increase proxy buffer to handle some OpenERP web requests
proxy_buffers 16 64k;
proxy_buffer_size 128k;
#general proxy settings
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# 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;
proxy_set_header Host $http_x_forwarded_host;
# Let the Odoo web service know that we’re using HTTPS, otherwise
# it will generate URL using http:// and not https://
proxy_set_header X-Forwarded-Proto http;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# by default, do not forward anything
proxy_redirect off;
proxy_buffering off;
location / {
proxy_pass http://odoo-server;
}
location /longpolling {
proxy_pass http://odoo-server-im;
}
# cache some static data in memory for 90mins.
# under heavy load this should relieve stress on the odoo web interface a bit.
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo-server;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment