Cài đặt nginx cho server  :

sudo apt-get install nginx

Sau đó vào thư mục : /etc/nginx/sites-enabled tạo file odoo.hbsprogram.com.conf

upstream odoo {
 server 127.0.0.1:8069;
}

upstream odoo-chat {
 server 127.0.0.1:8072;
}

server {
    server_name odoo.hbsprogram.com;
    return 301 http://odoo.hbsprogram.com$request_uri;
}

server {
   listen 80;
   server_name odoo.hbsprogram.com;

   
   
   access_log /var/log/nginx/odoo.access.log;
   error_log /var/log/nginx/odoo.error.log;

   proxy_read_timeout 720s;
   proxy_connect_timeout 720s;
   proxy_send_timeout 720s;
   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;

   location / {
     proxy_redirect off;
     proxy_pass http://odoo;
   }

   location /longpolling {
       proxy_pass http://odoo-chat;
   }

   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;
}

Sau đó chạy lệnh :

service odoo restart
service nginx restart

 

Leave a Reply

Your email address will not be published. Required fields are marked *