Skip to content

Instantly share code, notes, and snippets.

@imidsac
Created February 18, 2020 10:39
Show Gist options
  • Save imidsac/40bbbde636bf50c9b4d8dfabc032ad76 to your computer and use it in GitHub Desktop.
Save imidsac/40bbbde636bf50c9b4d8dfabc032ad76 to your computer and use it in GitHub Desktop.
# Odoo servers
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
# HTTP -> HTTPS
server {
listen 80;
server_name www.malinuse.com malinuse.com;
# include snippets/letsencrypt.conf;
return 301 https://malinuse.com$request_uri;
}
# WWW -> NON WWW
server {
listen 443 ssl http2;
server_name www.malinuse.com;
ssl_certificate /etc/letsencrypt/live/travel.malinuse.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/travel.malinuse.com/privkey.pem; # managed by Certbot
# ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
return 301 https://malinuse.com$request_uri;
}
server {
listen 443 ssl http2;
server_name malinuse.com;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Proxy headers
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;
# SSL parameters
ssl_certificate /etc/letsencrypt/live/travel.malinuse.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/travel.malinuse.com/privkey.pem; # managed by Certbot
# ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
# log files
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;
# Handle longpoll requests
location /longpolling {
proxy_pass http://odoochat;
}
# Handle / requests
location / {
proxy_redirect off;
proxy_pass http://odoo;
}
# Cache static files
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
# Gzip
gzip_types text/css text/less 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