Community mailing list archives

community@mail.odoo.com

RE: Create virtual hosts for odoo website on nginx (server blocks)

by
Bassirou Ndaw
- 10/18/2015 07:59:07

Have you already created the database PROD? Does it exists?

 

 

 

From: Houssine BAKKALI [mailto:houssine.bakkali@gmail.com]
Sent: Sonntag, 18. Oktober 2015 13:28
To: Community <community@mail.odoo.com>
Subject: Re: Create virtual hosts for odoo website on nginx (server blocks)

 

in your dns are you redirecting mycompany.com or www.mycompany.com? use the second one in case is wasn't the one you used

try with X-ODOO_DBFILTER which is the one used for v8

 

2015-10-18 13:12 GMT+02:00 Yassine Teimi <yteimi01@gmail.com>:

I need to map mycompany.com to database PROD

 

I'm pointing my dns to my VPS, and for that  I created a virtual host (sever block) for this domain name, and a dns zone, and all necesseary configuration files for that purpose, using bind. So I think the domaine name is well configured.

 

I deleteed the db_filter parameter from the odoo-server.conf file, and I restarted the odoo server.

 

Here after my virtual host configured on nginx : 

 

upstream backend-odoo {

  server 127.0.0.1:8070 weight=1 fail_timeout=600s;

}

server {

  listen 80;

  server_name www.mycompany.com;

# log files

  access_log  /var/log/nginx/access.log;

  error_log   /var/log/nginx/error.log;

  proxy_set_header X-OpenERP-dbfilter PROD;

  location / {

    proxy_pass http://backend-odoo;

  }

}

 

After all this, I still have the database selector, when I want to access my website using : www.mycompany.com

 

Is there something missing on the virtual host configuration.

 

 

 

 

 

 

2015-10-18 11:57 GMT+01:00 Houssine BAKKALI <houssine.bakkali@gmail.com>:

no you don't need to set the db_filter in your config file. the module db_filter_from_header is server wide so you don't need to install it on all your databases.

you maybe miss something in the config.

if your db name is asco and your domain name is mycompany.com and that you want to map the following subdomain myodoo to your db.

you shoud first configure your dns to redirect myodoo.mycompany.com to your server

the the server name of your virtual server should be myodoo.mycompany.com

 

and the directive should be


proxy_set_header X-OpenERP-dbfilter asco;

I think it's case sensitive so take this into account

I hope this help

 

2015-10-18 12:42 GMT+02:00 Yassine Teimi <yteimi01@gmail.com>:

On the odoo config file, do I have to delete the db_filter parameter ?

 

 I let it as it is, and added the proxy_set header paramter on the server block like I told you, and it doesn't work. It  redirects me to the database selector.

 

Note that I installer db_filter_from header on all available databases. 

 

Thanks for your reply.

 

2015-10-17 22:04 GMT+01:00 Yassine Teimi <yteimi01@gmail.com>:

Thanks houssine for your help, it was a pleasure.

Le 17 oct. 2015 21:47, "Houssine BAKKALI" <houssine.bakkali@gmail.com> a écrit :

yep!

 

2015-10-17 22:02 GMT+02:00 Yassine Teimi <yteimi01@gmail.com>:

Ah okay,

So my virtual hosts (server blocks), will be like this :

Server {

Server_name www.domain1.com
proxy_set_header X-OpenERP-dbfilter [database_name_2]
}

Server {

Server_name www.domain2.com
proxy_set_header X-OpenERP-dbfilter [database_name_2]
}

Correct me if I'm wrong.

Thanks a lot Houssine.

                        

Le 17 oct. 2015 20:52, "Houssine BAKKALI" <houssine.bakkali@gmail.com> a écrit :

you just do the same than for subdomains... you define one virtual server per domain or subdomain and you sert the "proxy_set_header X-OpenERP-dbfilter [your filter];" directive in each virtual server definition... each one mapping to the desired database...

 

2015-10-17 21:47 GMT+02:00 Yassine Teimi <yteimi01@gmail.com>:

Yes, but I have multiple domain name, i understand that if i want to do a mapping into a single database,  for a single domain name, but how to do the same for the other domain names ?

The goal is how to redirect every domain name to its database with this module.

Thanks houssine for your help. I hope I made myself clear.

Le 17 oct. 2015 19:52, "Houssine BAKKALI" <houssine.bakkali@gmail.com> a écrit :

With the module you bypass the database filter so no needs to set it in the odoo config file...

Le 17 oct. 2015 18:57, "Yassine Teimi" <yteimi01@gmail.com> a écrit :

Okay, and if I want to create multiple database filters, each filter is related to a domain name. (because I'm in multi domain environnement), how to handle this on nginx?

As I Understood, I Should create a proxy_set_header for every server block. How son I technically do this ?

Le 17 oct. 2015 17:37, "Houssine BAKKALI" <houssine.bakkali@gmail.com> a écrit :

This module is independent from the domain or the sub domain. You choose in you filter to which database you virtual server will be redirected to

Le 17 oct. 2015 18:18, "Yassine Teimi" <yteimi01@gmail.com> a écrit :

Thanks a lot Houssine, 

 

Is the module able to handle mapping with domain names too ? for example, I want to map my domain name to a database using this module, is that possible ?

 

2015-10-17 14:08 GMT+01:00 Houssine BAKKALI <houssine.bakkali@gmail.com>:

the subdomain name should be equal to your database name... except if you use www as subdomain

the OCA module is dbfilter_from_header

with this module you will need to add this line
proxy_set_header X-OpenERP-dbfilter [your filter]; where you replace [your filter] by the database name that you want to map to this sub.domain

 

2015-10-17 14:47 GMT+02:00 Yassine Teimi <yteimi01@gmail.com>:

Thanks houssine,

So first i've to create my subdomain, and configure it this way on the server block, then use a regex expression on dbfilter to map my subdomain into a database with the same subdomain name, at least a database name containing the subdomain name.

I remember we had a previous discussion about this, and we also talked about an odoo module that allows you to map a subdomain to odoo database, without the condition : subdomaine name=odoo database name. Can you tell me more about this ?

Le 17 oct. 2015 13:33, "Houssine BAKKALI" <houssine.bakkali@gmail.com> a écrit :

nope you replace xxxx or yyyy by the subdomain of your choice the one you defined...

www.example.com or myodoo.example.com

keep in mind that subdomain name can be mapped to database name using dbfilter in your odoo config file...

 

2015-10-16 23:03 GMT+02:00 Yassine Teimi <yteimi01@gmail.com>:

Ah okay Thanks.

 

So you did "xxxx.example.com" to listen to subdomains too ? 

 

Why did you do "yyyy.example.com" too ?

 

 

 

2015-10-16 21:46 GMT+01:00 Bassirou Ndaw <b.ndaw@ergobit.org>:

In Odoo, you do not have a path where website files reside but a running odoo server which is listening on a given port (default port 8069). This server and the port are given in the 2nd line of the config below. The redirection to this server take place in the last line of the config

 

 

 

From: Yassine Teimi [mailto:yteimi01@gmail.com]
Sent: Freitag, 16. Oktober 2015 21:58
To: Community <community@mail.odoo.com>
Subject: Re: Create virtual hosts for odoo website on nginx (server blocks)

 

Thanks for your anwser, 

 

Usually with other CMS we use a root parameter, where the website files resides, with Odoo how is it handled ? I can't see any routing parameter in your files ? 

 

Regards.

 

2015-10-16 20:33 GMT+01:00 Bassirou Ndaw <b.ndaw@ergobit.org>:

Hi,

 

here is an example which is currently running as reverse proxy for odoo

 

--------------------------------------------------------------------------------------------

upstream odoo-server {

    server 127.0.0.1:8069 weight=1 fail_timeout=0;

}

 

upstream odoo-server-im {

    server 127.0.0.1:8326 weight=1 fail_timeout=0;

}

 

## http redirects to https ##

server {

             listen 80;

    server_name  

                           xxxx.ergobit.org

                           yyyy.ergobit.org ;

             # Strict Transport Security

             add_header Strict-Transport-Security max-age=2592000;

             rewrite ^/.*$ https://$host$request_uri? permanent;

    #return 301 https://$host$request_uri;

}

 

server {

    listen 443;

    server_name  

                           xxxx.ergobit.org

                           yyyy.ergobit.org ;

 

    # Specifies the maximum accepted body size of a client request,

    #   as indicated by the request header Content-Length.

    client_max_body_size 200m;

 

    # ssl certificate files

    ssl on;

    ssl_certificate        /etc/ssl/certs/abcd.xyz.crt;

    ssl_certificate_key    /etc/ssl/private/acd.xzy.key;

   

    # ssl log files

    access_log    /var/log/nginx/odoo-access.log;

    error_log    /var/log/nginx/odoo-error.log;

 

    # add ssl specific settings

    keepalive_timeout    90;

 

    # increase proxy buffer to handle some OpenERP web requests

    proxy_buffers 16 64k;

    proxy_buffer_size 128k;

 

             #general proxy settings

    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;

 

    # Let the OpenERP web service know that we’re using HTTPS, otherwise

    # it will generate URL using http:// and not https://

    proxy_set_header X-Forwarded-Proto https;

 

    # by default, do not forward anything

    proxy_redirect off;

    proxy_buffering off;

 

    location / {

        proxy_pass    http://odoo-server;

    }

 

    location /longpolling {

        proxy_pass    http://odoo-server-im;

    }

 

    # cache some static data in memory for 90mins.

    #     under heavy load this should relieve stress on the odoo web interface a bit.

    location ~* /web/static/ {

        proxy_cache_valid 200 90m;

        proxy_buffering    on;

        expires 864000;

        proxy_pass http://odoo-server;

    }

 

}

--------------------------------------------------------------------------------------------

 

Best regards

Bassirou Ndaw

 

 

From: Yassine Teimi [mailto:yteimi01@gmail.com]
Sent: Freitag, 16. Oktober 2015 20:32
To: Community <community@mail.odoo.com>
Subject: Re: Create virtual hosts for odoo website on nginx (server blocks)

 

I'm using nginx as a reverse proxy, does it impact the virtual host (server block) creation ? 

 

2015-10-16 19:03 GMT+01:00 Yassine Teimi <yteimi01@gmail.com>:

Dears,

I've created a server blocks (on nginx) or virtual host (on apache), i want someone to share his virtual host created under nginx, so as to compare with mine, then i'll feed you guys more informations about my concern.

Thanks for your answers.



 

--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-27 33 30 78

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



 

--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-27 33 30 78

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



 

--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-27 33 30 78

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



 

--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-27 33 30 78

_______________________________________________

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



 

--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-27 33 30 78

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



 

--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-27 33 30 78

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

 

_______________________________________________
Mailing-List:
https://www.odoo.com/groups/community-59
Post to:
mailto:community@mail.odoo.com
Unsubscribe:
https://www.odoo.com/groups?unsubscribe