ERPGAP Blog / How to Use NGINX to Reverse Proxy Odoo
How to Use NGINX to Reverse Proxy Odoo

How to Use NGINX to Reverse Proxy Odoo


Routing the HTTP and Long-polling Ports


Reverse Proxy Odoo with NGINX

Odoo is a truly diverse and customizable software option to pick. When using Odoo NGINX reverse proxy options are possible.

Here’s a tutorial on how to reverse proxy Odoo using NGINX.

Find More Tutorials

# Upstreams for the http and longpolling ports
# these (odoosrv and odoolong) vars will be used in other places in the conf file
# refer to:
#     http://nginx.org/en/docs/http/load_balancing.html

upstream odoosrv {
   server 127.0.0.1:8069 weight=1 fail_timeout=0;
}
upstream odoolong {
   server 127.0.0.1:8072 weight=1 fail_timeout=0;
}
server {
listen 443 ssl;
server_name www.example.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
client_max_body_size 4M;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types
text/css
text/javascript
text/xml
text/plain
image/bmp
image/gif
image/jpeg
image/jpg
 image/png
 image/svg+xml
 image/x-icon
 application/javascript
 application/json
 application/rss+xml
 application/vnd.ms-fontobject
 application/x-font-ttf
 application/x-javascript
 application/xml
 application/xml+rss;

location ~^/web/database {
rewrite ^/web/database(.*) http:// permanent;
}
location ~* ^/([^/]+/static/|web/(css|js)/|web/image/|web/content/|website/image/) {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 30d;
proxy_pass http://odoosrv;
}
location / {
proxy_connect_timeout 360s;
proxy_send_timeout 360s;
proxy_read_timeout 360s;
proxy_pass http://odoosrv;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
proxy_redirect off;
}
location /longpolling {
proxy_pass http://odoolong;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
proxy_redirect off;
}
ssl_certificate /certs/fullchain.pem;
ssl_certificate_key /certs/privkey.pem;
include /certs/options-ssl-nginx.conf;
ssl_dhparam /certs/ssl-dhparams.pem; }
Have Questions About Nginx Odoo Options?

Other articles



How to Setup an Odoo development environment

How to Setup an Odoo development environment

Making Odoo Webshop and Website Faster

Making Odoo Webshop and Website Faster

Odoo Domain Operators

Odoo Domain Operators

About us

Odoo is a management software that fits all sizes. This software is for small, medium and large companies. Your company's information is all in one place. You don't have to go back and forth to check something. All apps have real-time access to your database.

Tags tags