Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Odoo 14 Multi-site, Multi-company, Same Server, Shared Database - not forwarding traffic to the correct domain!

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
2 Respuestas
13656 Vistas
Avatar
West Budreau

This is the first time reaching out to the community, and only after months of trial and error, a ton of googling, reading 4 of the Odoo textbooks, and all the documentation I can find I still haven't been able to figure this out this problem - and I think it's probably something simple, so I figured I'd reach out.

Here's the scenario:

-Odoo 14 Community edition running on an AWS EC2 instance

-9 Separate Companies

-9 Public Facing Websites

-All Websites / Companies Sharing the Same Database

-VM Running on Debian 10


The Problem:

Despite my best efforts, I can't seem to get web traffic to route to the front-end websites correctly! Everything routes to the "main" website when typing any of the domains for the 9 publicly facing websites... and I can't seem to figure out how to configure the web servers to work properly.


Configurations:

I used one of Bitnami's EC2 stacks to provision the instance to get started with the Apache2 as the web server, of which I've installed Nginx to act as a reverse proxy after researching the performance / security improvements while possibly solving this domain redirection problem but have not had any luck. From my understanding, with the Multi-site configurations in Odoo 14, this shouldn't be a problem - yet it persists.

-web.base.url points to the default localhost:8069, I've tried the approach of "logging into each site as the admin" and setting the "web.base.url.freeze" to True, which has yet to work correctly, and also have tried changing the localhost:8069 to point to a "odoo.website.com" type name, thinking it might avoid conflicts with the front-end side with no luck

-httpd.conf: Prior to installing Nginx, I configured the main file to point to the httpd-vhosts.conf file

-httpd-vhosts.conf: I've tried setting this file up with the *:80 & *:443, for each of the 9 domains in the same file. I've tried replacing the * with localhost, the public / static IP for 80 & 127.0.0.1 for 443, using the proxy pass directive to point to the respective localhost:8069 addresses, and longpolling addresses on port 8072, and and just about everything else you can think of with no luck in resolving the domains

-odoo-server.conf: I'm still confused on the whole "db filter" thing, since I have one database I'm not sure this would matter, is there is something I need to change here? Maybe with the %h or #d? I've tried setting the proxy to Yes and No, and ya - totally lost.

-Nginx: When setting up nginx.conf, I changed the ports of apache to :8080 & :8443, and configured he t9 individual server blocks in the sites-enabled folder for each site based on documentation, and also provisioned the ssl certs or Nginx as well - but am still not sure if I did it correctly.

-"Proxy" vs "SSL" configuration with Nginx: Perhaps I'm doing something wrong here with the directives in the Nginx Server Blocks, I've been getting errors relating to "multiple longpolling addresses", but since that's only used for the chat I wouldn't think it would impact my domain redirection problem - but regardless, it does seem I might be confused on how to properly configure Nginx on the "proxy" side of things vs the "SSL" side of things.


An Easy Problem to fix:

From what I can tell, my problem comes from my lack of knowledge as a developer / programmer / server admin / etc... And it seems there is a simple solution that would take 5 minutes if I just knew the way to configure these dang web servers correctly!

My background is on the entrepreneurial side of things, Odoo after researching many ERP solutions over the past 4 years, it seems - if configured properly - it could solve all of my problems and help manage all of these ventures I plan on building in the most cost-effective approach! 

My main objective is to get these websites up and running so I can begin preparing for a major funding round in the next 3 months and have the technology infrastructure put together so I can organize these businesses and properly delegate the functions and get everything in operation! I've been down many rabbit holes, and I'd say I've learned enough about the enterprise architecture side of things, but through this "cowboy development" approach - I'm at a roadblock until I figure out how to properly direct traffic to these damn domains!


Possible Solutions / Guidance:

I feel like I'm "almost there" although I've been saying that for the past 2 months and after having destroyed something like 20+ virtual machines on multiple cloud platforms - but I feel confident in my knowledge of what I've learned about how all this stuff ought to work. Perhaps, the best way someone could help would be to clarify the best practices around:

-How to properly configure the odoo-server.conf file to work with nginx in this scenerio

-What is the role of apache in all this? Doesn't Odoo have its own built-in webserver? Do I even need apache? If so, what do I need to do with apache's httpd.conf / httpd-vhosts.conf files?

-If I do need apache, how do I configure the server blocks with Nginx - how might they relate to vhosts in apache? Do I need to assign different internal IP addresses to the same port? Do I need one vhost in apache and multiple in Nginx? What are the directives / relationships between proxy server vs the ssl side of things and how might they be configured properly?

-What is the best practices in terms of databases? Should I have a different database for each site? Different databases for each company? It seems the simplest approach is my current configuration, as it seems having different databases would affect the tight integrations between the parent company(s) / subsidiaries between the front-end and back end... am I correct?

-What is the quickest and easiest way to make sure these domain addresses get resolved to the correct website? 

Please let me know if there are any recommendations or advice! I feel it's a simple thing to solve, but with all of this "cowboy development" type shenanigans I need help pulling myself out of the rabbit hole!

3
Avatar
Descartar
Avatar
Ermin Trevisan
Mejor respuesta

Please excuse my quick browsing of you extensive text, but I hope I can point you to most important issues and show you, how I did it myself a similar setup, but even with multiple databases. The following describes how I made it work in my environment. There may be other ways, there may be flaws, but it works.

Remarks (or my personal opinions/experiences):

- You are correct, when using related companies and manage relations to a parent company, multi-company is the way to go
- Do not use a Bitnami image, install it yourself, it is easy enough (read the documentation).
- Do not use a VM (what for anyway?), if it is important, use Docker
- You are right, there is no need for Apache, Odoo has its inbuilt web server
- Use a reverse_proxy for SSL termination, but install it on a separate server in the subnet, which has a firewall open to the public (ports 80, 443). Depending on the traffic, a t2.nano EC2 is a good starter.
- install Odoo on a server in a private subnet without public access, allow access only to the reverse proxy
- if you don't understand nginx (for me it's too complicated), use a Caddy Server, which is much easier to use

dbfilter:


dbfilter is a Regex-based mechanism to translate the hostname of an incoming http-Request (i.e. https://www.example.com) to one or more database names. Please use Google to find more information. The most common use case is to set a database name, which relates to a subdomain of the hostname, example: database name is "odoo", the hostname is https://odoo.example.com.

In your case, you can set the dbfilter hardcoded to your database name, or you can use the OCA module dbfilter_from_header to keep the opportunity to still use more than one database. The module is available for Odoo 13.0, but you can simply change the version to 14 in the __manifest__.py file and it works.

How to do it:


- In Odoo Website Settings, set the proper domain name to each website, example: www.company1.com, this is also the vhost name you have to define in the reverse proxy

- In the odoo.conf file set dbfilter to your database name (dbfilter = databasename) or , when you use the module dbfilter_from_header, let pass everything (dbfilter = .*). Set proxy_mode = True. If you use dbfilter_from_header, add it to the list of serverwide modules.

- Here's the settings in the default odoo.conf file:

[options]
...
...
...

dbfilter = .*
proxy_mode = True

...
...
server_wide_modules = base,web,dbfilter_from_header
...
...

- and here is a sample vhost declaration (Caddyfile) you have to define for each website domain:

company1.com {
redir https://www.company1.com{uri}
}


www.company1.com {
reverse_proxy http://168.xxx.xxx.xxx:8069 

header_up X-Real-IP {remote}
header_up X-Forwarded-Proto https
header_up X-Forwarded-Host {host}
header_up X-Url-Scheme {scheme}
header_up X-Odoo-dbfilter databasename
}

encode gzip zstd
file_server
log {
output file /var/log/caddy/caddy.log
}
}

Please be aware that Caddy Server automatically provides and renews SSL certificates, so there is nothing else to do, it is as simple as that.

2
Avatar
Descartar
zahid

HI Ermin Trevisan,
I have a setting in V15,CE one shared database, two companies and two differente domains :
company1 .-> www.company1.com
company2 www.company2.com
I applied exactly the steps you described , but it is not working. www.company2.com always forwarding to www.company1.com.
Do you have any clue what i am missing here ?
Thanks

Avatar
Adil Akbar
Mejor respuesta

Hi, 

You can see following for this:

https://youtu.be/GkNgc-fZO-I

Hope it helps,

Thanks

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Sitio web hecho con

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now