Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk11 min

How to Point Two Domains to the Same Website on a VPS

Pointing two domains to one website on a VPS requires matching DNS records, name-based web-server configuration, complete HTTPS certificates, and a clear canonical-domain policy.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Yes. Two domains can use the same VPS and serve the same website. Point each domain’s A record (and its AAAA record if you use IPv6) to the VPS public address, then configure your web server to recognize both hostnames. NGINX does this with server_name; Apache uses ServerName and ServerAlias. Finally, install a TLS certificate covering every hostname that accepts HTTPS.

You must also choose a URL policy: keep both domains publicly accessible with identical content, or make one the canonical address and permanently redirect the other. The DNS records get visitors to the VPS; the web-server configuration decides which site answers; HTTPS configuration proves the requested hostname is trusted.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How two domains reach one website

A browser sends a request for a hostname such as example.com. DNS translates that hostname to an IP address. If both example.com and second-example.com resolve to the same VPS address, both requests arrive at the same machine.

DNS does not select a folder or website. Once the request reaches the VPS, the HTTP Host header tells the web server which hostname the visitor requested. NGINX matches that name against server_name. Apache matches it against ServerName and ServerAlias. The selected virtual host then serves a document root, proxies to an application, or sends a redirect.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

For HTTPS, the hostname is also presented during the TLS handshake through Server Name Indication (SNI). The server must have a certificate whose names include every hostname visitors may open. One IP address can therefore support many HTTPS domains, provided the virtual-host and certificate configuration is correct.

Decide whether both domains stay public

There are two sound designs. Select one before configuring redirects, cookies, analytics, and search-engine settings.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Design What visitors see When it fits Main obligation
Both domains active Either hostname remains in the address bar and serves the same content. Brand aliases, regional entry points, campaigns, or a temporary migration. Configure every hostname consistently, including HTTPS, cookies, canonical links, and application-generated URLs.
One canonical domain The alternate hostname returns a permanent redirect to the preferred HTTPS URL. Most public sites, rebrands, migrations, and situations where duplicate URLs are undesirable. Keep the alternate domain resolving and serving the redirect, and retain certificate coverage for it.

A redirecting domain still needs DNS and a web-server listener. If it does not reach the VPS, the server cannot issue the redirect or answer an ACME certificate challenge.

Prepare the VPS and domain information

  • Record the VPS public IPv4 address. If the VPS has working IPv6, record its public IPv6 address too.
  • Confirm that you control both domains and know which DNS service is authoritative for each one. DNS may be managed at a registrar or at a separate DNS provider.
  • Identify the web server and the configuration layout: NGINX, Apache, or a control panel that generates either configuration.
  • Choose the website’s document root or application upstream, such as /var/www/site.
  • List every hostname you will accept. Decide separately whether the www form belongs to each domain.
  • Make sure inbound TCP ports 80 and 443 are allowed by the VPS firewall and any cloud firewall. Port 80 is needed for ordinary HTTP and commonly for certificate validation; port 443 serves HTTPS.

Do not create records for names you do not intend to serve. A certificate and a redirect policy are easiest to maintain when the hostname list is explicit.

Step 1: Point both domains in DNS

Create the address records

At the authoritative DNS provider, create an A record for each apex domain that points to the VPS IPv4 address:

Name Type Value Purpose
@ (or the provider’s apex notation) A VPS public IPv4 Routes the bare domain to the VPS.
www A or CNAME VPS IPv4, or the intended canonical hostname Routes the www hostname if you will accept it.
@ AAAA VPS public IPv6 Routes IPv6-capable clients when IPv6 is configured correctly.
www AAAA or CNAME VPS IPv6, or the intended canonical hostname Provides an IPv6 path for www.

Repeat the appropriate records for the second domain. Use a CNAME only where your DNS provider permits it and where its target is the hostname you actually want to follow. Remove stale A or AAAA records that point elsewhere; otherwise some visitors can reach a different server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Check authoritative answers

After saving records, query the names from a machine with DNS tools:

dig +short example.com A
dig +short example.com AAAA
dig +short second-example.com A
dig +short second-example.com AAAA

Each command should return the address you intend to use. DNS propagation time depends on the previous record’s TTL and resolver caches, so a recently changed value may not appear everywhere immediately. Do not proceed on the assumption that a web-server change can compensate for a name that still resolves to the old host.

Apache’s documentation makes this separation explicit: creating a virtual host does not create DNS entries. The names must resolve to the server before users can reach that virtual host.

Step 2: Configure NGINX for both domains

Serve the same content under both names

When both hostnames should remain active, put all accepted names in one server block. The following pattern serves the same document root:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com second-example.com www.second-example.com;

    root /var/www/site;
    index index.html index.htm;

    location / {
        try_files $uri $uri/ /index.html;
    }
}

Adjust the root, index files, and application routing to your site. For a reverse-proxied application, the location / block would pass requests to your upstream instead of using try_files. The important part for domain sharing is the complete server_name list. NGINX uses that directive to determine which server block handles a request.

Make the alternate domain redirect

If example.com is canonical and second-example.com is only an alias, use a separate port-80 block for the alternate name:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
server {
    listen 80;
    listen [::]:80;
    server_name second-example.com www.second-example.com;

    location ^~ /.well-known/acme-challenge/ {
        root /var/www/acme;
    }

    location / {
        return 301 https://example.com$request_uri;
    }
}

The $request_uri variable preserves the path and query string. Keep the ACME challenge location reachable on port 80 while obtaining or renewing a certificate. After HTTPS is configured, create the canonical HTTPS server block and redirect HTTPS requests for the alternate names as well.

Test and reload safely

  1. Save the file in the directory used by your distribution or hosting panel, then enable it according to that layout.
  2. Run nginx -t. Do not reload if the test reports a syntax or certificate-path error.
  3. Reload with systemctl reload nginx (or the reload method used by your system).
  4. Request each hostname with an explicit Host header or a real DNS name and confirm that the expected content or redirect is returned.

A configuration test checks syntax; it does not prove that DNS, firewall rules, the document root, or the certificate are correct. Check those independently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Step 3: Configure Apache for both domains

Use one name-based virtual host

Apache supports name-based virtual hosting, meaning multiple names can run on one IP address. For a shared HTTP site, use one virtual host with a primary name and aliases:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com second-example.com www.second-example.com
    DocumentRoot /var/www/site

    <Directory /var/www/site>
        Require all granted
        AllowOverride All
    </Directory>
</VirtualHost>

Use the directory permissions and override policy your application requires. ServerName identifies the primary hostname; ServerAlias adds the other names that should select this virtual host.

Redirect an alternate domain

For a canonical-domain policy, give the alternate hostnames their own virtual host and return a permanent redirect. Preserve the ACME challenge path if your certificate process validates over HTTP:

<VirtualHost *:80>
    ServerName second-example.com
    ServerAlias www.second-example.com

    Alias /.well-known/acme-challenge/ /var/www/acme/.well-known/acme-challenge/
    <Directory /var/www/acme/.well-known/acme-challenge/>
        Require all granted
    </Directory>

    Redirect permanent / https://example.com/
</VirtualHost>

If you use rewrite rules or a reverse proxy instead of Redirect, keep the same two requirements: every alternate hostname must match this virtual host, and the challenge URL must not be redirected away from the validation file.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Enable, test, and reload

  1. Place the virtual-host file in Apache’s sites or configuration directory.
  2. Enable it using your distribution’s site-management command if required.
  3. Run apachectl configtest (or httpd -t on systems that use that command).
  4. Reload Apache only after the test reports Syntax OK, using systemctl reload apache2 or the service name used by your distribution.
  5. Check that the intended virtual host is selected for each hostname and that an unrelated default site is not answering first.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Step 4: Enable HTTPS for every accepted hostname

Include all names in certificate coverage

If visitors can open four names—example.com, www.example.com, second-example.com, and www.second-example.com—the certificate presented for each HTTPS request must include the corresponding name. A certificate for only the primary domain will produce a browser name-mismatch warning on the others.

You can use one certificate containing all required names or separate certificates associated with separate virtual hosts. The choice depends on your certificate automation and server layout. With one IP, SNI lets the server select the appropriate certificate when multiple HTTPS names are configured.

Keep port 80 available for validation and redirect

Many automated certificate authorities validate control of a hostname by requesting a file beneath /.well-known/acme-challenge/ over HTTP. Do not blanket-redirect or block that path during issuance or renewal. Serve the challenge from the configured web root, then redirect ordinary HTTP requests to the canonical HTTPS URL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build the HTTPS virtual hosts

For a shared-content design, the HTTPS listener should list the same names as the HTTP listener and reference the certificate and key that cover them. A conceptual NGINX block looks like this:

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name example.com www.example.com second-example.com www.second-example.com;

    ssl_certificate     /etc/ssl/site/fullchain.pem;
    ssl_certificate_key /etc/ssl/site/privkey.pem;
    root /var/www/site;

    location / {
        try_files $uri $uri/ /index.html;
    }
}

Use the equivalent Apache SSL virtual-host configuration generated by your operating system or certificate tool. Do not copy certificate paths unless those files exist and are readable by the web server.

For a canonical design, the primary HTTPS virtual host serves the site and the alternate HTTPS virtual host returns a 301 to the primary HTTPS URL. The alternate certificate still needs to cover the alternate hostname because TLS negotiation happens before the server can send the redirect.

Choose the right DNS and TLS arrangement

Decision Option A Option B Practical consequence
Web server NGINX with server_name Apache with ServerName/ServerAlias Use syntax native to the server actually listening on ports 80 and 443.
Public URL policy Both domains serve content One domain redirects Active aliases require consistent application behavior; redirects concentrate visitors on one URL.
TLS certificates One certificate containing all names Separate certificates Either works when every HTTPS virtual host presents a matching certificate and renewals are automated.
DNS management Registrar-hosted DNS Separate authoritative DNS provider The record interface differs, but each authoritative zone must point the names to the VPS.

Validate the finished setup

Test each hostname separately. A successful test must cover DNS, HTTP routing, HTTPS routing, and the certificate name.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Resolve DNS: Run dig or an equivalent lookup for A and AAAA records. Confirm that no stale address remains.
  2. Check HTTP: Run curl -I http://example.com/ and repeat for every hostname. Expect the shared content or a 301 to the exact canonical HTTPS URL.
  3. Check HTTPS: Run curl -I https://example.com/ and repeat for every name. Confirm that the response is from the intended site.
  4. Inspect certificates: In a browser, open the certificate details and verify that the requested hostname appears in the Subject Alternative Name list. A command-line TLS client can also show the certificate presented with SNI.
  5. Test both address families: If you publish AAAA records, test from an IPv6-capable network. An incorrect IPv6 record can make some users reach the wrong host even when IPv4 works.
  6. Run the server test before every reload: Use nginx -t for NGINX or apachectl configtest/httpd -t for Apache.

Troubleshoot the common failure modes

The second domain shows a different website

Check DNS first. If the name resolves to another IP, fix the A or AAAA record and wait for caches to expire. If DNS is correct, inspect the web-server name list. A missing hostname may fall through to the default server or default virtual host.

The browser reports a certificate mismatch

The certificate presented for that hostname does not contain its exact name, or the request is reaching a different server. Verify A and AAAA answers, ensure SNI-enabled HTTPS configuration includes the hostname, and issue or install a certificate with all required names.

HTTP works but HTTPS fails

Confirm that port 443 is open in both the VPS and cloud firewalls, that an HTTPS listener exists, and that certificate and key paths are valid. A configuration test usually identifies missing files or syntax errors before reload.

Redirect loops occur

Loops commonly arise when both the VPS and an upstream proxy force HTTPS while the application believes the request is still HTTP. Inspect the Location header with curl -I, then make one layer authoritative for the redirect and pass the correct forwarded-protocol information to the application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Certificate renewal cannot find the challenge

Make sure the hostname resolves to this VPS, port 80 is reachable, and the /.well-known/acme-challenge/ path is served from the expected directory rather than redirected, blocked, or handled by a different virtual host.

Only some users see the old server

Different recursive resolvers may still cache the old record until its TTL expires. Check authoritative answers and several independent resolvers before changing the web-server configuration again. An old AAAA record is especially easy to overlook when IPv4 testing succeeds.

Application details that matter when aliases share content

Web-server routing is only one layer. Applications often generate absolute URLs, set cookie domains, enforce an allowed-host list, or build redirects from the incoming hostname.

  • Set the application’s public or canonical URL deliberately. Otherwise links may switch between the two domains.
  • If both domains are intentionally active, verify that login cookies, callback URLs, password-reset links, and payment or API integrations accept the intended hostnames.
  • If one domain is canonical, perform the redirect at the edge and configure the application’s canonical URL to match it.
  • Review cache keys and content-security policies. A cache that ignores the hostname can accidentally serve one domain’s host-specific response to the other.
  • Keep analytics, sitemap, and canonical-link settings consistent with your chosen URL policy.

Scaling the pattern beyond two domains

The same name-based approach supports more aliases on one VPS. Add each hostname to the NGINX server_name directive or Apache ServerAlias, add matching DNS records, and include every HTTPS name in certificate management. For a large list, separate domains into logical server blocks when they need different redirects, certificates, roots, or application behavior. The limiting factors are configuration clarity, certificate renewal, and application correctness—not the fact that the IP address is shared.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Operational checklist

  • Every intended hostname has the correct A record.
  • Every published AAAA record points to a functioning IPv6 service.
  • DNS names resolve before users are directed to the new VPS.
  • NGINX has the complete server_name list, or Apache has the correct ServerName and ServerAlias values.
  • The document root or upstream is the same for every active alias.
  • Alternate names have an explicit 301 policy if they should not remain public.
  • Port 80 remains available for ACME challenge files.
  • Certificates cover every hostname accepted on port 443.
  • Configuration tests pass before reload.
  • HTTP, HTTPS, redirects, certificate names, and both IP versions have been tested independently.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.