Skip to content

Instantly share code, notes, and snippets.

@jbarreraballestas
Last active July 21, 2023 14:08
Show Gist options
  • Save jbarreraballestas/3f94a3308ad49c7549ae11f61f0294fe to your computer and use it in GitHub Desktop.
Save jbarreraballestas/3f94a3308ad49c7549ae11f61f0294fe to your computer and use it in GitHub Desktop.
Odoo nginx configuration
#odoo server
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name odoo.novato.pro;
# Redirect all HTTP requests to HTTPS
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name odoo.novato.pro;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# SSL certificate configuration
ssl_certificate /etc/letsencrypt/live/novato.pro/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/novato.pro/privkey.pem;
# Redirect websocket requests to odoo gevent port
location /websocket {
proxy_pass http://odoochat;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
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;
}
# Odoo proxy configuration
location / {
# Add Headers for odoo proxy mode
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_redirect off;
proxy_pass http://odoo;
}
# Static file caching for improved performance (optional)
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment