Skip to content

How to Set Up an Odoo Subdomain (erp.yourdomain.com)

DeployMonkey Team · March 11, 2026 8 min read

A subdomain like erp.yourdomain.com keeps your Odoo instance logically separated from your main website while staying under your brand. This guide covers DNS, nginx configuration, and SSL — whether you are setting this up on a self-managed VPS or using DeployMonkey.

What Is a Subdomain and When Should You Use One?

A subdomain is a prefix added to your root domain. Common Odoo subdomain patterns include:

  • erp.yourcompany.com — general ERP access
  • odoo.yourcompany.com — explicit naming
  • crm.yourcompany.com — if Odoo is used primarily for CRM
  • portal.yourcompany.com — customer-facing portal

Using a subdomain (rather than a path like yourcompany.com/erp) is the recommended approach because Odoo expects to run at the root of its hostname and does not support path-prefix deployments without significant configuration.

Prerequisites

  • A domain registered with access to its DNS settings
  • A VPS or server running Odoo (see Odoo server requirements)
  • nginx installed and running
  • Certbot installed: sudo apt install certbot python3-certbot-nginx

Step 1 — Create the CNAME or A Record

Log into your DNS provider and add a record for the subdomain. Use an A record if you know your server's static IP (most VPS setups), or a CNAME if you are pointing to a hostname:

# A record (static IP — most common for VPS)
Type:  A
Name:  erp
Value: 203.0.113.42    (your server public IP)
TTL:   300

# CNAME (pointing to a managed hostname)
Type:  CNAME
Name:  erp
Value: your-instance.deploymonkey.com
TTL:   300

Set TTL to 300 (5 minutes) during setup so you can correct mistakes quickly. Raise it to 3600 once everything is working.

Step 2 — Verify DNS Resolution

Before configuring nginx or requesting an SSL certificate, confirm the subdomain resolves to your server:

# Check resolution
dig erp.yourdomain.com A +short

# Verify from multiple resolvers
dig @8.8.8.8 erp.yourdomain.com +short
dig @1.1.1.1 erp.yourdomain.com +short

# HTTP connectivity test (expect a 200 or redirect from nginx/Odoo)
curl -I http://erp.yourdomain.com

If dig returns your IP but curl times out, check your server's firewall — port 80 must be open.

Step 3 — Write the nginx Server Block

Create a new nginx site configuration at /etc/nginx/sites-available/odoo-erp:

upstream odoo_backend {
server 127.0.0.1:8069;
}

upstream odoo_longpolling {
server 127.0.0.1:8072;
}

server {
listen 80;
server_name erp.yourdomain.com;

# Redirect HTTP to HTTPS (certbot will add this automatically)
# return 301 https://$host$request_uri;

access_log /var/log/nginx/odoo_erp_access.log;
error_log  /var/log/nginx/odoo_erp_error.log;

# Proxy to Odoo
location / {
    proxy_pass http://odoo_backend;
    proxy_set_header Host              $host;
    proxy_set_header X-Real-IP         $remote_addr;
    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_redirect off;

    # Timeouts for long operations
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;

    # Buffer settings
    proxy_buffering off;
    client_max_body_size 200m;
}

# Longpolling for live chat and bus notifications
location /longpolling {
    proxy_pass http://odoo_longpolling;
    proxy_set_header Host            $host;
    proxy_set_header X-Real-IP       $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

# Static file caching
location ~* \.(js|css|png|jpg|jpeg|gif|ico|woff|woff2|ttf|svg)$ {
    proxy_pass http://odoo_backend;
    proxy_cache_valid 200 60m;
    expires 7d;
    add_header Cache-Control "public, immutable";
}
}

Enable the site and test:

sudo ln -s /etc/nginx/sites-available/odoo-erp /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx

Step 4 — Provision SSL with Certbot

sudo certbot --nginx -d erp.yourdomain.com

Certbot will:

  1. Perform an HTTP-01 challenge to verify you control the domain (this is why DNS must resolve first).
  2. Issue a 90-day certificate from Let's Encrypt.
  3. Automatically modify your nginx config to add SSL directives and an HTTP→HTTPS redirect.
  4. Install a cron job or systemd timer to auto-renew before expiry.

Test the renewal process:

sudo certbot renew --dry-run

If the dry run succeeds, your SSL renewal is configured correctly.

Step 5 — Verify the Resulting nginx Config

After certbot modifies your config, it should look like this:

server {
listen 443 ssl;
server_name erp.yourdomain.com;

ssl_certificate     /etc/letsencrypt/live/erp.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/erp.yourdomain.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

location / {
    proxy_pass http://odoo_backend;
    proxy_set_header Host              $host;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_redirect off;
    proxy_read_timeout 720s;
    client_max_body_size 200m;
}

location /longpolling {
    proxy_pass http://odoo_longpolling;
}
}

server {
listen 80;
server_name erp.yourdomain.com;
return 301 https://$host$request_uri;
}

Step 6 — Update Odoo proxy_mode and web.base.url

# odoo.conf
proxy_mode = True

In the Odoo UI, go to Settings → Technical → Parameters → System Parameters and update web.base.url to https://erp.yourdomain.com. This ensures all internal links, portal emails, and OAuth redirects use the correct URL.

Troubleshooting Common Issues

  • 502 Bad Gateway: nginx cannot reach Odoo on port 8069. Check that Odoo is running: systemctl status odoo or ss -tlnp | grep 8069.
  • SSL certificate error: Certbot challenge failed. Verify DNS resolution and that port 80 is not blocked by a firewall.
  • Odoo redirects to localhost: proxy_mode is not set in odoo.conf, or web.base.url has not been updated.
  • Session keeps expiring: Ensure the Host header is passed correctly in the proxy_set_header directive.

Subdomain Setup on DeployMonkey

DeployMonkey removes all of the above complexity:

  1. In your instance dashboard, go to Settings → Custom Domain.
  2. Enter your subdomain (erp.yourdomain.com) and click Save.
  3. Add the CNAME record shown by DeployMonkey to your DNS provider.
  4. Once the record propagates, click Verify & Enable SSL.

DeployMonkey provisions the SSL certificate, configures nginx with optimal settings (including longpolling and static file caching), sets proxy_mode, and updates web.base.url automatically. SSL auto-renews with no manual steps. See our guide on custom domain setup for more detail on DNS record types.

FAQ

Can I run multiple Odoo instances on different subdomains on the same server?

Yes. Create separate nginx server blocks for each subdomain, each pointing to a different Odoo port (e.g., 8069, 8070). Each Odoo instance needs its own database and its own port configured in its odoo.conf. Certbot can issue certificates for multiple subdomains independently.

Do I need a wildcard SSL certificate for Odoo subdomains?

No. A standard Let's Encrypt certificate for the specific subdomain (e.g., erp.yourdomain.com) is sufficient. Wildcard certificates (*.yourdomain.com) are useful only if you need SSL for many subdomains simultaneously or if your subdomains are dynamically generated.

Why is my Odoo longpolling (live chat) not working after adding a subdomain?

The /longpolling path must be proxied to port 8072 (not 8069). Add a separate location /longpolling block in your nginx config pointing to http://127.0.0.1:8072.

Can I use a subdomain of a domain I do not own the root of?

Only if you control DNS for that subdomain. Some DNS providers allow delegating a specific subdomain's DNS zone (NS records) to another provider, but you must have authority over the zone to add records.

How do I redirect the old IP-based URL to my new subdomain?

Add a server block on port 80 that matches the IP or old hostname and returns a 301 redirect: return 301 https://erp.yourdomain.com$request_uri;. This preserves URL paths and is SEO-safe.

Get Your Odoo Running at erp.yourdomain.com Today

DeployMonkey handles subdomain configuration, SSL, and nginx tuning automatically on every paid plan. No command line required. Start your free instance and add a custom subdomain in minutes.