DNS & Domain Configuration

Learn how to configure DNS and domains for your SaaS platform. This determines how your tenants will access their CRM instances.

After installing the module, you need to decide how your tenants will access their CRM. This is one of the most important decisions for your SaaS platform, so let's explain all the options clearly.

Understanding URL Structures

The module supports three different ways for tenants to access their CRM. Here's what each one looks like:

Option 1: Subdirectory Mode (Easiest Setup)

https://yoursite.com/ws/tenant-name

Example: If your domain is mycrm.com and a tenant named "Acme Corp" signs up, they'll access their CRM at:

https://mycrm.com/ws/acme-corp

Pros:

  • No additional DNS configuration needed

  • Works on any hosting plan

  • No wildcard SSL required

  • Simplest setup

Cons:

  • Less "professional" looking than a subdomain

  • Tenants can't use custom domains

Best for: Getting started quickly, testing, small deployments.

Option 2: Subdomain Mode

Example: Acme Corp would access their CRM at:

Pros:

  • Professional and branded appearance

  • Each tenant feels like they have their own platform

  • Industry standard for SaaS platforms

Cons:

  • Requires wildcard DNS record

  • May require wildcard SSL (but we have workarounds!)

Best for: Professional SaaS deployments, businesses that want to impress clients.

Option 3: Custom Domain Mode

Example: Acme Corp could use their own domain:

Pros:

  • Maximum branding for your tenants

  • Tenants can use their own company domain

  • Highest perceived value

Cons:

  • Each tenant needs to configure their DNS

  • Requires more setup per tenant

Best for: Enterprise offerings, premium plans, white-label services.


Setting Up Subdirectory Mode

This is the default mode and requires almost no DNS setup.

Step 1: Enable Subdirectory Structure

  1. Go to SaaS Management β†’ SuperAdmin Settings

  2. Click the MySQL Server Settings tab

  3. Set "Use Subdir Structure '/ws/{tenant}'" to Yes

  4. Click Save Settings

Step 2: That's It!

Seriously β€” if you're using subdirectory mode, there's no DNS configuration needed. Tenants will automatically be accessible at yoursite.com/ws/tenant-slug.


Setting Up Subdomain Mode

Subdomain mode requires a wildcard DNS record. Here's exactly how to set it up:

What Is a Wildcard DNS Record?

A wildcard DNS record is a special DNS entry that catches ALL subdomains and points them to your server. Instead of creating a DNS record for each tenant individually (which would be impossible), one wildcard record handles them all.

Think of it like a mail redirect: "Any mail addressed to anything@yourcompany.com should go to the main office."

Step 1: Find Your Server's IP Address

You need your server's IP address. Here's how to find it:

  • cPanel: Look at the top of your cPanel dashboard β€” it shows your IP

  • VPS/Cloud: Check your hosting provider's dashboard

  • Command line: Run curl ifconfig.me on your server

Step 2: Add the Wildcard DNS Record

  1. Log in to your domain registrar (where you bought your domain β€” e.g., Namecheap, GoDaddy, Cloudflare)

  2. Go to the DNS settings for your domain

  3. Add a new A Record with these settings:

Field
Value

Type

A

Host/Name

* (just an asterisk)

Value/Points to

Your server's IP address (e.g., 123.456.789.0)

TTL

Automatic (or 3600)

circle-exclamation

Step 3: Wait for DNS Propagation

DNS changes don't take effect instantly. They need to "propagate" across the internet:

  • Cloudflare: Usually instant (within 5 minutes)

  • Most registrars: 15 minutes to 4 hours

  • Some registrars: Up to 24-48 hours (rare)

You can check if your DNS has propagated using dnschecker.orgarrow-up-right.

Step 4: Disable Subdirectory Mode

  1. Go to SaaS Management β†’ SuperAdmin Settings

  2. Click the MySQL Server Settings tab

  3. Set "Use Subdir Structure '/ws/{tenant}'" to No

  4. Click Save Settings

Now tenants will be accessible at tenant-name.yoursite.com instead of yoursite.com/ws/tenant-name.


Setting Up Custom Domains

Custom domains allow tenants to use their own domain (like crm.theircompany.com) to access their CRM. This is a premium feature that your tenants will love!

How Custom Domains Work

  1. You enable the Custom Domain feature in the tenant's plan

  2. The tenant enters their desired domain in their dashboard

  3. The tenant (or you) points their domain's DNS to your server's IP

  4. The module automatically detects the domain and routes traffic to the correct tenant

Enabling Custom Domains

  1. Go to SaaS Management β†’ Plans

  2. Edit the plan where you want to enable custom domains

  3. In Advanced Features, toggle "Enable Custom Domain" to ON

  4. Save the plan

Enable Custom Domain in plan settings
Toggle "Enable Custom Domain" in the Advanced Feature section of your plan

What Your Tenants Need to Do

When a tenant wants to use a custom domain, they need to add DNS records pointing to your server. The module includes a built-in DNS guide that tenants can access with one click:

Custom Domain DNS Settings Guide
The built-in DNS guide tells your tenants exactly what DNS records to add β€” no support tickets needed!

The guide tells them to:

  1. Add an A Record with their domain pointing to your server's IP

  2. Optionally add a www version

  3. Wait for DNS propagation (up to 48 hours)


DNS Configuration Cheat Sheet

Here's a quick reference for all the DNS records you might need:

Purpose
Type
Host/Name
Value

Main domain

A

@

Your server IP

www version

A

www

Your server IP

Wildcard subdomains

A

*

Your server IP

Tenant custom domain

A (on tenant's DNS)

@

Your server IP


Testing Your DNS Configuration

After making DNS changes, test them:

  1. Open a browser and navigate to a test subdomain: http://test123.yourdomain.com

  2. If you see your Perfex CRM (or a landing page) β€” DNS is working!

  3. If you see an error β€” DNS hasn't propagated yet. Wait and try again.

You can also use these online tools to check:

circle-check

Last updated