How to setup NGINX Reverse Proxy with odoo server on ubuntu 14.04/16.04/18.04
We are using NGINX as Reverse Proxy on same machine in front of odoo server which accepts request from clients on 8069 port.
sudo apt install nginx
rm -rf /etc/nginx/sites-enabled/default
vi /etc/nginx/sites-enabled/odoo
upstream odoo { server 127.0.0.1:8069; } server { listen 80 default_server; listen [::]:80 default_server; location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; allow all;} # root /usr/share/nginx/html; index index.php index.html index.htm index.nginx-debian.html; server_name odoo.server; location ~ /\.ht { allow all; } access_log /var/log/nginx/odoo.access.log; error_log /var/log/nginx/odoo.error.log; proxy_buffers 16 64k; proxy_buffer_size 128k; location / { proxy_pass http://odoo; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_redirect off; proxy_set_header Host $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 https; } location ~* /web/static/ { proxy_cache_valid 200 60m; proxy_buffering on; expires 864000; proxy_pass http://odoo; } }
service nginx start