跳至内容
Odoo 菜单
  • 登录
  • 免费试用
  • 应用程序
    财务
    • 会计
    • 发票
    • 费用
    • 电子表格 (BI)
    • 文档
    • 电子签名
    销售
    • 客户关系管理
    • 销售
    • POS 销售点管理-零售
    • POS 销售点管理 - 餐厅
    • 订阅
    • 租赁
    网站
    • 网站设计
    • 电子商务
    • 博客
    • 论坛
    • 在线客服
    • 在线学习
    供应链
    • 库存
    • 制造
    • 产品生命周期
    • 采购
    • 维护保养
    • 品控
    人力资源
    • 员工
    • 招聘
    • 休假
    • 评价
    • 内部推荐
    • 车队
    营销
    • 社媒营销
    • 电邮营销
    • 短信营销
    • 近期活动
    • 营销自动化
    • 网上调查
    服务
    • 项目管理
    • 工时单
    • 现场服务
    • 服务台
    • 排期
    • 预约
    生产力
    • 讨论
    • 批核
    • IoT物联网
    • VoIP
    • 知识库
    • WhatsApp
    第三方应用软件 Odoo 定制 Odoo云端平台
  • 行业
    零售
    • 书店
    • 服装店
    • 家具店
    • 食品杂货店
    • 五金店
    • 玩具店
    餐饮与酒店服务
    • 酒吧及酒馆
    • 餐厅
    • 快餐
    • 民宿
    • 饮品分销商
    • 酒店
    房地产
    • 房地产代理
    • 建筑师事务所
    • 建造业
    • 地产管理
    • 园艺
    • 业主协会
    咨询
    • 会计师事务所
    • Odoo合作伙伴
    • 市场推广公司
    • 律师事务所
    • 人才招聘
    • 审核 & 认证
    制造
    • 纺织
    • 金属
    • 家具
    • 食品
    • 啤酒厂
    • 企业礼品
    保健与健身
    • 体育俱乐部
    • 眼镜店
    • 健身中心
    • 健康从业者
    • 药房
    • 发型屋
    商贸服务
    • 维修人员
    • IT 硬件及支持
    • 太阳能系统
    • 鞋匠
    • 清洁服务
    • 暖通空调服务
    其他
    • 非营利组织
    • 环境机构
    • 广告牌租赁
    • 摄影服务
    • 自行车租赁
    • 软件经销商
    浏览所有行业
  • 社区
    学习
    • 教学视频
    • 文档
    • 认证
    • 培训
    • 博客
    • 播客
    赋能教育
    • 教育计划
    • Scale Up! 商业游戏
    • 参观Odoo
    获取软件
    • 下载
    • 版本对比
    • 发布
    合作
    • Github
    • 论坛
    • 近期活动
    • 翻译
    • 成为合作伙伴
    • 合作伙伴服务
    • 注册您的会计事务所
    获取服务
    • 寻找合作伙伴
    • 查找会计服务
    • 预约顾问咨询
    • 安装及推行服务
    • 客户参考
    • 支持
    • 升级
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    获取演示
  • 定价
  • 技术支持

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

  • 客户关系管理
  • e-Commerce
  • 会计
  • 库存
  • PoS
  • 项目
  • MRP
All apps
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
帮助

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

订阅

此帖文有活动时,接收通知

此问题已终结
2 回复
13781 查看
形象
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
形象
丢弃
形象
Ermin Trevisan
最佳答案

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
形象
丢弃
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

形象
Adil Akbar
最佳答案

Hi, 

You can see following for this:

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

Hope it helps,

Thanks

0
形象
丢弃
喜欢讨论吗?不要只阅读,加入进来!

立即创建账户,享受专属功能,与我们的精彩社区互动!

注册
社区
  • 教学视频
  • 文档
  • 论坛
开源
  • 下载
  • Github
  • Runbot
  • 翻译
服务
  • Odoo.sh 托管
  • 支持
  • 升级
  • 自定义开发服务
  • 教育
  • 查找会计服务
  • 寻找合作伙伴
  • 成为合作伙伴
关于我们
  • 我们的公司
  • 品牌资产
  • 联系我们
  • 招聘
  • 近期活动
  • 播客
  • 博客
  • 客户
  • 法律 • 隐私
  • 安全
الْعَرَبيّة 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致力于为企业管理提供高效智能的开源解决方案,是全球业内高速成长的软件服务商之一,逾七百五十万用户选择Odoo进行数字化升级。通过一系列全业务链覆盖、高度集成、简单易用的商业应用,助力企业实现信息化改革、降本增效并释放公司增长潜力。

Odoo独特的价值在于是一款非常容易使用又完全集成的应用。

Website made with

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