Sun, 23 Nov 2014
Other day i needed to add a different subdomain for different server. All you need to accomplish this is placing this switch in Odoo server:
openerp-server -c configfile.conf --db-filter ^%d$
We will get redirection of subdomain.domain.com to filter=subdomain
Now, sometimes we need to publish different servers, because there are different versions or just because we want them to have different modules, so we have 2 instances:
then we just use nginx with the following configuration file:
server {
listen 80;
server_name localhost.com default_server;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
location / {
proxy_pass http://0.0.0.0:8069;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
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;
}
# cache some static data in memory for 60mins.
location ~* ^/(openerp|openobject|web)/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://0.0.0.0:8069;
}
}
server {
listen 80;
server_name crmdatabase.localhost.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
location / {
proxy_pass http://0.0.0.0:8282;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
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;
}
# cache some static data in memory for 60mins.
location ~* ^/(openerp|openobject|web)/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://0.0.0.0:8282;
}
}
I use this config often for test servers. Just came up to me that we could also use this having 2 subdomains like *.v7.odoo.example.com and *.v8.odoo.example.com.