Skip to content

Instantly share code, notes, and snippets.

@lukebranch
Last active October 22, 2016 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukebranch/d6e81fb484f2eb5642084d30fc7f707b to your computer and use it in GitHub Desktop.
Save lukebranch/d6e81fb484f2eb5642084d30fc7f707b to your computer and use it in GitHub Desktop.
# BASED ON - http://www.schenkels.nl/2014/12/reverse-proxy-with-odoo-8-nginx-ubuntu-14-04-lts/
upstream odoo8example {
server 127.0.0.1:8069 weight=1 fail_timeout=3000;
}
upstream odoo8example-im {
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}
server {
listen 80;
# listen [::]:80 ipv6only=on;
# server_name example.com;
server_name example.com;
# root /opt/odoo/odoo-server;
# index index.html index.htm index.php;
# }
## ODOO-Specific Settings
# Specifies the maximum accepted body size of a client request,
# as indicated by the request header Content-Length.
client_max_body_size 1000m;
# add ssl specific settings
keepalive_timeout 60;
# increase proxy buffer to handle some OpenERP web requests
proxy_buffers 16 64k;
proxy_buffer_size 128k;
#general proxy settings
# force timeouts if the backend dies
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# set headers
proxy_set_header Host $host;
# proxy_set_header X-Forwarded-Host example.com;
proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-ODOO-dbfilter EXAMPLE;
# Lasley Edits
port_in_redirect off;
## proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Front-End-Https On;
## proxy_set_header X-Real-IP $remote_addr;
# by default, do not forward anything
proxy_redirect off;
proxy_buffering off;
location / {
proxy_redirect off;
proxy_pass http://odoo8example;
}
location /longpolling {
proxy_pass http://odoo8example-im;
}
# cache some static data in memory for 60mins.
# under heavy load this should relieve stress on the OpenERP web interface a bit.
location /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo8example;
}
access_log /var/log/nginx/example.com.access.log;
access_log /var/log/nginx/example.com.apachestyle.access.log;
error_log /var/log/nginx/example.com.error.log;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment