网站域名

域名是标识网站等在线位置的文本地址。与数字 IP 地址相比,域名为人们提供了一种更易于记忆和识别的互联网导航方式。

**Odoo 云端版**和**Odoo.sh**数据库默认使用`odoo.com`**域名**的**子域**(例如`mycompany.odoo.com`)。

您也可以通过 注册免费域名,使用自定义域名。

使用Odoo注册免费域名

To register a one-year free domain name for your Odoo Online database, sign in to your account and go to the database manager. Click the (gear) button next to the database name and select Domain Names.

访问数据库域名配置

搜索所需的域名并检查其可用性。

搜索可用域名

小技巧

如果域名注册选项未出现,请确保已安装网站应用程序。

Select the desired domain name, fill in the Domain Owner form, and click Register. The chosen domain name is directly linked to the database.

填写域名所有者信息

Next, you should map your domain name to your Odoo website.

重要

一封来自 noreply@domainnameverification.net 的验证电子邮件将发送到在 域名所有者 表格中提供的电子邮件地址。请务必验证您的电子邮件地址,以保持域名有效,并在到期前收到续费报价。

域名注册第一年免费。之后,Odoo 将继续与 Gandi.net 合作管理该域名,并按照 Gandi.net 续订费率进行收费 <https://www.gandi.net/en/domain>`_。Odoo 每年会在域名到期日前几周向:guilabel:`域名所有者`表单中提到的电子邮件地址发送续期报价单。报价确认后,域名将自动续期。

注解

  • 此优惠仅适用于 Odoo 云端版 数据库。

  • 每位客户仅限**一个**域名。

  • 该优惠仅限于注册**新**域名。

  • 此优惠适用于*一个应用程序免费*计划。请确保您的网站包含足够的原创内容,以便 Odoo 验证您的请求是否合理,并遵守 `Odoo的可接受使用政策<https://www.odoo.com/acceptable-use>`_。鉴于请求数量较多,Odoo 可能需要几天时间进行审核。

DNS 记录

To manage your free domain name DNS records, open the database manager, click the (gear) button next to the database name, select Domain Names, and click DNS.

  • A:A 记录包含域名的 IP 地址。它是自动创建的,**不能**编辑或删除。

  • CNAME:CNAME 记录将一个域或子域转发到另一个域。其中一条记录是自动创建的,用于将 www. 子域映射到数据库。如果数据库重命名,CNAME 记录也**必须**重命名。

  • MX:MX 记录指示服务器将电子邮件发送到何处。

  • TXT:TXT 记录可用于不同目的(如验证域名所有权)。

对 DNS 记录的任何修改都可能需要长达 72 小时 才能在全球所有服务器上传播。

注解

Contact Odoo support if you need assistance to manage your domain name.

邮箱

一年免费域名优惠**不**包括邮箱。有两种方式可将域名与邮箱联系起来。

使用子域名

您可以创建一个子域名(例如`subdomain.yourdomain.com`)作为数据库的别名域名。这样,用户就可以在数据库中创建记录,这些记录来自他们在`email@subdomain.yourdomain.com`别名中收到的电子邮件。

To do so, open the database manager, click the (gear) button next to the database name and select Domain Names. Click DNS, then Add DNS record and select CNAME. Next, enter the desired subdomain in the Name field (e.g., subdomain), the original database domain with a period at the end (e.g., mycompany.odoo.com.) in the Content field, and click Add record.

然后,单击 使用自定义域名,输入别名域名(例如,subdomain.yourdomain.com),单击 验证,然后单击 确认,完成,将别名域添加为您的*自定义域名。

最后,进入数据库并打开 设置’。在 :guilabel:`别名域名 字段下,输入别名域名(例如,subdomain.yourdomain.com),单击 创建,然后单击 保存

使用外部电子邮件服务器

To use an external email provider, you should configure an MX record. To do so, open the database manager, click the (gear) button next to the database name and select Domain Names. Click DNS, then Add DNS record and select MX. The values you should enter for the Name, Content, and Priority fields depend on the external email provider.

Google Workspace

To use your free domain name on Gmail, register to Google Workspace.

During the registration process, select Set up using your existing domain when asked to Choose a way to set up your account, and enter your domain (e.g., yourdomain.com) when asked What’s your business’s domain name?.

Domain ownership verification
  1. Sign in to Google Workspace. When asked to verify you own your domain, click Switch to manual verification.

    Switching to manual domain verification on Google Workspace
  2. Select gandi.net as the Domain host and click Continue.

    Selecting the domain host on Google Workspace
  3. Copy the content of the Value field under TXT record. Leave the window open.

    Copying the TXT value on Google Workspace
  4. Open the database manager, click the (gear) button next to the database name and select Domain Names. Click DNS, then Add DNS record and select TXT.

  5. Enter @ in the Name field, paste the Value provided by Google in the Content field, and click Add record.

    Creating a TXT record to verify domain name ownership
  6. Go back to Google Workspace, tick the box at the bottom, and click Confirm.

Redirect emails to Gmail
  1. Open the database manager, click the (gear) button next to the database name and select Domain Names. Click DNS, then Add DNS record, and select MX.

  2. Enter @ in the Name field, 1 in the Priority field, smtp.google.com. in the Content field, and click Add record.

    Creating an MX record to redirect emails to Gmail
  3. Open the Google Workspace Admin console, click Activate Gmail for your domain, and follow the steps.

配置现有域名

如果您已经有一个域名,则可将其用于您的 Odoo 网站。

警告

强烈建议按**顺序**这三个步骤,以避免出现任何 SSL 证书验证 问题:

  1. 添加 CNAME 记录

  2. Redirect your naked domain name (optional, but recommended)

  3. 将您的域名映射到 Odoo 数据库

  4. 将您的域名映射到您的 Odoo 网站

添加 CNAME 记录

Adding a CNAME record to forward your domain name to the address of your Odoo database is required.

CNAME 记录的目标地址应为创建时定义的数据库地址(例如,mycompany.odoo.com)。

具体说明取决于您的 DNS 托管服务。

Redirect a naked domain

注解

Although optional, completing this step is advised.

To let visitors use your naked domain name (a domain name without any subdomains or prefixes) (yourdomain.com), creating a 301 redirect (a permanent redirect from one URL to another) to www.yourdomain.com is required:

  • from http://yourdomain.com to https://www.yourdomain.com, and

  • from https://yourdomain.com to https://www.yourdomain.com.

The specific instructions depend on your DNS hosting service. However, not all of them offer to redirect a naked domain with a secure HTTPS connection. If you encounter any issue, we recommend using Cloudflare.

Using Cloudflare to secure and redirect a naked domain

  1. Sign up and log in to Cloudflare.

  2. Enter your domain name on Cloudflare’s dashboard and select Quick scan for DNS records.

  3. Choose a plan (the free plan is sufficient).

  4. Follow Cloudflare’s instructions and recommendations to complete the activation.

  5. Add a CNAME record to redirect your naked domain (yourdomain.com) to the www subdomain (e.g., www.yourdomain.com) by clicking DNS in the navigation menu, then clicking the Add record button, and using the following configuration:

    • Type: CNAME

    • Name: @ (or yourdomain.com)

    • Target: e.g., www.yourdomain.com

    • Proxy status: Proxied

    Adding a CNAME DNS record to Cloudflare to redirect a naked domain to a www subdomain
  6. Add another second CNAME record to redirect the www subdomain (e.g., www.yourdomain.com) to your database address (e.g., mycompany.odoo.com) using the following configuration:

    • Type: CNAME

    • Name: e.g., www.yourdomain.com

    • Target: e.g., mycompany.odoo.com

    • Proxy status: DNS only

    Adding a CNAME DNS record to Cloudflare to redirect a www subdomain to an Odoo database
  7. Define a redirect rule to permanently redirect (301) your naked domain (e.g., yourdomain.com) to both http:// and https:// by going to Rules ‣ Create rule ‣ Products, and clicking Create a Rule under Redirect Rules:

    • Enter any Rule name.

    • Under the If incoming requests match… section, select Custom filter expression and use the following configuration:

      • Field: Hostname

      • Operator: equals

      • Value: e.g., yourdomain.com

    • Under the Then… section, use the following configuration:

      • Type: Dynamic

      • Expression: e.g., concat("https://www.yourdomain.com", http.request.uri.path)

      • Status code: 301

      • Preserve query string: enabled

    Defining a Cloudflare redirect rule to create a permanent redirect (301)
  8. Go to SSL/TLS and set the encryption mode to Full.

    Setting the encryption mode to full on Cloudflare

将域名映射到 Odoo 数据库

警告

在将域名映射到 Odoo 数据库之前,请确保您已在域名的 DNS 中 :ref:` 添加了 CNAME 记录 <domain-name/cname>`。

否则可能会阻止验证 SSL 证书,并导致 证书名称不匹配 错误。Web 浏览器通常会将此显示为警告,如*”您的连接不是专用的”*

If you encounter this error after mapping the domain name to your database, wait up to five days, as the validation may still happen. If not, you can submit a support ticket, including screenshots of your CNAME records.

Open the database manager, click the (gear) button next to the database name, select Domain Names, and click Use my own domain. Then, enter the domain name (e.g., www.yourdomain.com), click Verify and I confirm, it’s done.

将域名映射到 Odoo 云端版数据库

SSL 加密(HTTPS 协议)

**SSL 加密**允许访问者通过安全连接浏览网站,在网址开头显示为 https:// 协议,而不是非安全的 http:// 协议。

Odoo 使用 Let’s Encrypt 的证书颁发机构和 ACME 协议 为每个域生成单独的 SSL 证书 映射到数据库

注解

  • 证书生成最多可能需要 24 小时。

  • 在您将域名映射到数据库后的五天内,会多次尝试验证您的证书。

  • 如果您使用其他服务,可以继续使用,也可以改用 Odoo 的服务。

重要

裸域名 (不含任何子域名或前缀的域名) 不会生成 SSL 证书。

数据库的 Web 基本 URL

注解

如果数据库中已安装网站应用程序,请跳过本章节,继续 将域名映射到网站 部分。

数据库的 web base URL 或根 URL 会影响您的主网站地址以及发送给客户的所有链接(如报价单、门户链接等)。

要将自定义域名作为数据库的 web base URL,请使用自定义域名访问数据库,并以管理员 (管理下设置访问权限组中的用户) 身份登录。

重要

如果您使用原始 Odoo 地址(例如:mycompany.odoo.com)访问数据库,数据库的 web base URL 将相应更新。要防止管理员登录数据库时自动更新 web base URL,请激活 开发者模式,进入 设置 ‣ 技术 ‣ 系统参数 ‣ 新建,并输入 web.base.url.freeze 作为 ,将 True 输入为

注解

您也可以手动设置 web 基础 URL。要执行此操作,请激活 开发者模式,进入 设置‣ 技术 ‣ 系统参数,然后搜索 web.base.url 键(必要时创建),并输入您网站的完整地址作为值(例如,https://www.yourdomain.com)。URL 必须包括协议 https://`(或 `http://),且*不能*以斜线(/)结尾。

将域名映射到 Odoo 网站

将域名映射到网站与将域名映射到数据库不同:

  • 它将您的域名定义为网站的主域名,帮助搜索引擎正确索引您的网站。

  • 它将您的域名定义为数据库的基本 URL,包括通过电子邮件发送给客户的门户链接。

  • 如果您有多个网站,它会将您的域名映射到相应的网站。

进入 网站 ‣ 配置 ‣ 设置。如果有多个网站,请选择要配置的网站。在 域名 字段中,输入您网站的地址(例如,https://www.yourdomain.com),然后 保存

警告

将您的域名映射到 Odoo 网站可防止 Google 搜索索引您的原始数据库地址(例如,mycompany.odoo.com)。

如果两个地址都已编入索引,可能需要一段时间才能从 Google 搜索中删除第二个地址的索引。您可以使用 `Google搜索控制台 <https://search.google.com/search-console/welcome>`_来解决这个问题。

注解

如果您的数据库中有多个网站和公司,请确保在 网站 ‣ 配置 ‣ 设置 下选择正确的 公司。这样做将指示 Odoo 根据使用的公司将哪个 URL 用作 base URL