Advertisement
Guest User

Odoo nginx configuration

a guest
Apr 3rd, 2020
905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.86 KB | None | 0 0
  1. # redirects www to non-www
  2. server {
  3.     server_name www.subdomain.example.com;
  4.     return 301 $scheme://subdomain.example.com$request_uri;
  5. }
  6.  
  7. server {
  8.  server_name subdomain.example.com;
  9.  proxy_read_timeout 720s;
  10.  proxy_connect_timeout 720s;
  11.  proxy_send_timeout 720s;
  12.  
  13.  # Add Headers for odoo proxy mode
  14.  proxy_set_header X-Forwarded-Host $host;
  15.  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  16.  proxy_set_header X-Forwarded-Proto $scheme;
  17.  proxy_set_header X-Real-IP $remote_addr;
  18.  
  19.  # log
  20.  access_log /var/log/nginx/subdomain.example.com.access.log;
  21.  error_log /var/log/nginx/subdomain.example.com.error.log;
  22.  
  23.  # Redirect longpoll requests to odoo longpolling port
  24.  location /longpolling {
  25.   proxy_pass http://odoochat;
  26.  }
  27.  
  28.  # Redirect requests to odoo backend server
  29.  location / {
  30.    proxy_redirect off;
  31.    proxy_pass http://odoo;
  32.  }
  33.  
  34.   # hold static files on memory for 60 min.
  35.   # helps relieve odoo interface a bit under heavy load
  36.   location ~* /web/static/ {
  37.     proxy_cache_valid 200 60m;
  38.     proxy_buffering on;
  39.     expires 864000;
  40.     proxy_pass http://odoo;
  41.   }
  42.  
  43.   # common gzip
  44.   gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
  45.   gzip on;
  46.  
  47.   listen 443 ssl; # managed by Certbot
  48.   ssl_certificate /etc/letsencrypt/live/subdomain.example.com/fullchain.pem; # managed by Certbot
  49.   ssl_certificate_key /etc/letsencrypt/live/subdomain.example.com/privkey.pem; # managed by Certbot
  50.   include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  51.   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  52. }
  53.  
  54. # redirects http to https
  55. server {
  56.     if ($host = subdomain.example.com) {
  57.         return 301 https://$host$request_uri;
  58.     } # managed by Certbot
  59.  
  60.  listen 80;
  61.  server_name subdomain.example.com;
  62.  return 404; # managed by Certbot
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement