---
title: "Multi-Tenancy · Nuxt Site Config · Nuxt SEO"
canonical_url: "https://nuxtseo.com/docs/site-config/guides/multi-tenancy"
last_updated: "2026-08-14T19:30:59.667Z"
meta:
  description: "Learn how to serve multiple sites with different configurations based on the hostname."
  "og:description": "Learn how to serve multiple sites with different configurations based on the hostname."
  "og:title": "Multi-Tenancy · Nuxt Site Config · Nuxt SEO"
---

Nuxt SEO on GitHub

Switch to Site ConfigSwitch to Nuxt SEOSwitch to RobotsSwitch to SitemapSwitch to OG ImageSwitch to Schema.orgSwitch to Link CheckerSwitch to SEO UtilsSwitch to Skew ProtectionSwitch to AI Ready

**Core Concepts**

# **Multi-Tenancy**

## Introduction

Multi-tenancy allows you to serve multiple sites with different configurations using a single Nuxt application. This is useful when you need to:

- Host multiple domains with different branding
- Serve region-specific content
- Maintain multiple sites with shared codebase

You can configure multi-tenancy using static configuration or dynamically at [**~~runtime~~**](https://nuxtseo.com/docs/site-config/guides/runtime-site-config).

## Usage

To use build-time multi-tenancy configuration you can use the `**multiTenancy**` option:

nuxt.config.ts

```ts
export default defineNuxtConfig({
  site: {
    multiTenancy: [
      {
        hosts: ['www.example.com', 'example.com', 'local.example.com'],
        config: {
          name: 'Example',
          url: 'example.com' // canonical
        },
      },
      {
        hosts: ['www.foo.com', 'foo.com', 'local.foo.com'],
        config: {
          name: 'Foo',
          url: 'foo.com', // canonical
          description: 'Foo description',
        },
      },
    ]
  }
})
```

Each multi-tenant configuration requires:

- `**hosts**`: An array of hostnames that should use this configuration

It's recommended to add any non-canonical hostnames to the `**hosts**` array to avoid duplicate content issues. For example, www.\* and non-www.\* hostnames should use the same configuration.

- `**config**`: The site configuration to apply when the hostname matches

The config object supports all standard site configuration options plus any custom properties you need.

## How it works

1. When the module receives a request, it checks the hostname against the configured hosts arrays
2. When it finds a match, it applies the corresponding config
3. The configuration is made available via `**useSiteConfig()**` in Nuxt app code (client and SSR), and via `**getSiteConfig(event)**` in Nitro handlers or middleware where you have access to the `**H3Event**`

## Runtime Multi-Tenancy

Runtime multi-tenancy is useful when you need to:

- Set configuration based on complex runtime conditions
- Load configuration from external sources
- Handle dynamic subdomains
- Implement A/B testing scenarios

To get started with runtime multi-tenancy you'll need to create a Nitro plugin.

server/plugins/site-config.ts

```ts
import { getNitroOrigin } from '#site-config/server/composables'

export default defineNitroPlugin((nitroApp) => {
  nitroApp.hooks.hook('site-config:init', ({ event, siteConfig }) => {
    const origin = getNitroOrigin(event)
    // Example: Set configuration based on subdomain
    if (origin.startsWith('https://fr.')) {
      // push whatever config you'd like for this request
      siteConfig.push({
        name: 'Mon Site',
        url: 'https://fr.example.com',
        defaultLocale: 'fr',
        currentLocale: 'fr',
      })
    }
  })
})
```

Check the [`**site-config:init**`](https://nuxtseo.com/docs/site-config/nitro-api/nitro-hooks#site-config-init) hook documentation for more information.

**Was this page helpful?**

### **Related **

[**Runtime Site Config**](https://nuxtseo.com/docs/site-config/guides/runtime-site-config)

[**Nitro Hooks**](https://nuxtseo.com/docs/site-config/nitro-api/nitro-hooks)

[**Understanding Site Config**](https://nuxtseo.com/docs/nuxt-seo/guides/site-config)

[**Runtime Site Config** Learn how to set site config at runtime in your Nuxt app.](https://nuxtseo.com/docs/site-config/guides/runtime-site-config) [**I18n Integration** How to use the Nuxt Site Config module with @nuxtjs/i18n or nuxt-i18n-micro.](https://nuxtseo.com/docs/site-config/guides/i18n)