odoo-nginx 配置
upstream erp_server {
server 127.0.0.1:9021 weight=1 fail_timeout=300s;
}
server {
# listen 80;
listen 443;
server_name www.xxxx.com;
#server_name api.erp.heqiauto.com
# Specifies the maximum accepted body size of a client request,
# as indicated by the request header Content-Length.
client_max_body_size 200m;
# ssl log files
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
error_page 500 502 503 504 /50x.html;
charset utf-8;
# increase proxy buffer to handle some OpenERP web requests
proxy_buffers 16 64k;
proxy_buffer_size 128k;
#gzip setting
gzip on;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 9;
gzip_buffers 16 8k;
gzip_min_length 2048;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/x-font-ttf;
location / {
proxy_pass http://127.0.0.1:9021/;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# set headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
# by default, do not forward anything
proxy_redirect off;
}
proxy_connect_timeout 5000s;
proxy_read_timeout 5000s;
proxy_send_timeout 5000s;
ssl on;
ssl_certificate /etc/nginx/cert/api.pem;
ssl_certificate_key /etc/nginx/cert/api.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
# cache some static data in memory for 60mins.
# under heavy load this should relieve stress on the OpenERP web interface a bit.
#location ~* /web/static/ {
# proxy_cache_valid 200 60m;
# proxy_buffering on;
# expires 864000;
# proxy_pass http://127.0.0.1:8059/;
# #proxy_pass http://openerpserver;
#}
}