Nginx反向代理配置

来自Odoo大V社-odoo中文开发手册
7017511讨论 | 贡献2017年12月28日 (四) 01:23的版本 (创建页面,内容为“以下代码,整个复制到你想放的域名配置文件中. ---- #odoo server upstream odoo { server 127.0.0.1:8069; } upstream odoochat { server 127.0.0.1:8...”)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

以下代码,整个复制到你想放的域名配置文件中.



  1. odoo server

upstream odoo {

server 127.0.0.1:8069;

} upstream odoochat {

server 127.0.0.1:8072;

}

  1. http -> https

server {

  listen 80;
  server_name sample.com;

proxy_read_timeout 720s; proxy_connect_timeout 720s; proxy_send_timeout 720s;

# Add Headers for odoo proxy mode

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;

# log

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

# Redirect requests to odoo backend server

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

location /longpolling { proxy_pass http://odoochat/longpolling/; }

# common gzip

#gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;

   include       mime.types;
   default_type  application/octet-stream;
   sendfile        on;
   keepalive_timeout  65;
   gzip  on;
   gzip_disable "msie6";
   gzip_vary on;
   gzip_proxied any;
   gzip_comp_level 6;
   gzip_buffers 16 8k;
   gzip_http_version 1.1;	 
   gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;	 


}