跳至內容
Odoo 選單
  • 登入
  • 免費試用
  • 應用程式
    財政
    • 會計
    • 發票
    • 開支報銷
    • 試算表 (BI)
    • 文件管理
    • 電子簽名
    銷售
    • 客戶關係
    • 銷售
    • POS 銷售點管理 - 零售
    • POS 銷售點管理 - 餐廳
    • 訂閱
    • 租賃
    網站
    • 網站製作
    • 電子商務
    • 網誌
    • 討論區
    • 線上客服
    • 網上學習
    供應鏈
    • 庫存
    • 製造管理
    • 產品生命周期
    • 採購
    • 保養維護
    • 品質管理
    人力資源
    • 員工管理
    • 招聘
    • 休假
    • 工作表現評核
    • 內部推薦
    • 車隊管理
    市場推廣
    • 社交媒體推廣
    • 電郵推廣
    • 短訊營銷
    • 活動
    • 自動化推廣
    • 網上調查
    服務
    • 專案管理
    • 工時管理
    • 外勤服務管理
    • 技術支援
    • 工作規劃
    • 預約管理
    生產力
    • 聊天
    • 批核
    • 物聯網
    • VoIP
    • 知識庫
    • WhatsApp
    第三方應用程式 Odoo Studio Odoo 雲端平台
  • 行業
    零售
    • 書店
    • 服裝店
    • 家具店
    • 食品雜貨店
    • 五金店
    • 玩具店
    餐飲及款待
    • 酒吧及酒館
    • 餐廳
    • 快餐
    • 賓館
    • 飲品分銷商
    • 酒店
    房地產
    • 地產代理公司
    • 建築師事務所
    • 建造業
    • 物業管理
    • 園藝
    • 業主聯會
    顧問服務
    • 會計公司
    • Odoo 合作夥伴
    • 市場推廣公司
    • 律師事務所
    • 人才招募
    • 審計及認證
    製造管理
    • 紡織
    • 金屬
    • 家具
    • 食品
    • 啤酒廠
    • 企業禮品
    保健與健身
    • 運動俱樂部
    • 眼鏡店
    • 健身中心
    • 健康從業人員
    • 藥房
    • 髮型屋
    技術行業
    • 雜工
    • IT 硬體與支援
    • 太陽能系統
    • 鞋匠
    • 清潔服務
    • 暖通空調服務
    其他
    • 非牟利組織
    • 環境保護機構
    • 廣告板租賃
    • 攝影服務
    • 自行車租賃
    • 軟體經銷商
    瀏覽所有行業
  • 社群
    學習
    • 教學影片
    • 使用說明
    • 認證
    • 培訓
    • 網誌
    • Podcast
    增強教學效能
    • 教育計劃
    • 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 回覆
13707 瀏覽次數
頭像
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 網頁寄存
  • 支援
  • 升級
  • 自訂功能開發
  • 教育及培訓
  • 尋找會計服務
  • 尋找合作夥伴
  • 成為合作夥伴
關於我們
  • 關於 Odoo 公司
  • 品牌資產
  • 聯絡我們
  • 招聘
  • 活動
  • Podcast
  • 網誌
  • 客戶
  • 法律 • 私隱政策
  • 安全性
الْعَرَبيّة 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 是一套開放源碼的商業管理系統,涵蓋你公司全部的營運需要,包括客戶關係管理(CRM)、電子商務、會計、庫存管理、POS(銷售點管理)、專案管理等應用程式。

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