From: http://my.oschina.net/wangbuke/blog/67450
Openerp 6.1 uses werkzeug as the Web service framework, and its performance is greatly improved compared with the previous cherrypy. However, werkzeug and cherrypy are not dedicated web servers. The common practice is to add an nginx, Apache, or other server before openerp. The following describes how to deploy openerp using nginx upstream.
Prerequisites
Assume that you have installed openerp and run it on 127.0.0.1: 8069.
2. Install nginx
Debian/Ubuntu:
# apt-get install nginx
RedHat/centos:
# yum install nginx
3. Configure nginx
1. Modify/etc/nginx. conf and enable gzip compression.
# Vi/etc/nginx. conf -------------- nginx. the conf file must be excerpted using unzip gzip on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_buffers 16 8 K; gzip_http_version 1.1; # Add a type of application/JavaScript gzip_types text/plain text/CSS application/JavaScript Application/JSON application/X-JavaScript text/XML application/XML + RSS text/JavaScript;
If you want to enable gzip, the difference is not small. Http: // 127.0.0.1/web/WebClient/JS loaded on the OE homepage the file size is 1.4 MB before it is enabled, and 350.6 kb after it is enabled (viewed through firebug ).
2. Create an openerp configuration file
# Touch/etc/nginx/sites-enabled/openerp # vi/etc/nginx/sites-enabled/openerp ------------------ the content of the openerp file contains proxy_temp_path/tmp/nginx_proxy_temp; proxy_cache_path/tmp/nginx_proxy_cache levels = keys_zone = oecache: 100 m inactive = 3D max_size = 1000 m; proxy_buffer_size 32 K; # Set Proxy Server (nginx) the buffer size for storing user header information proxy_buffers 4 32 K; # proxy_buffers buffer. If the average webpage size is below 32 K, set proxy_busy_buffe. Rs_size 64 K; # buffer size under high load (proxy_buffers * 2) proxy_temp_file_write_size 64 K; # Set the cache folder size. If it is greater than this value, the proxy_connect_timeout 60; proxy_send_timeout 60 will be passed; proxy_read_timeout 3000; upstream oeserver {server 127.0.0.1: 8069;} server {SERVER_NAME www.example.com; root/var/www/openerp-6.1-1/openerp/Addons; Location/{proxy_cache oecache; # proxy_cache_key "$ host $ request_uri $ request_body"; proxy_cache_key $ Host $ request_uri $ request_body; Requests 200 304 1D; returns any 1D; proxy_next_upstream http_502 http_504 error timeout invalid_header; proxy_pass_header set-cookie; proxy_set_header host $ host; proxy_set_header X-real-IP $ remote_addr; proxy_set_header X-forwarded-for $ response; proxy_redirect off; proxy_pass http: // oeserver; proxy_buffering on; proxy_cache_val Id 1D; expires 1D;} location ~ * \. (JS | CSS | PNG | JPG | JPEG | GIF | ico) $ {proxy_buffering on; proxy_cache_valid 1D; expires 1D ;}}
Done!
Nginx is only used as the front-end web server of openerp. nginx can achieve load balancing of openerp. Click here to leave the table blank.