October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Host Multiple Domains with SSL on a Single VPS

A practical Nginx and Certbot walkthrough for serving multiple domains securely from one VPS, covering DNS, certificates, redirects, renewal and common errors.
Length10 min Posted Quest giverVGSources Team

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.

Yes. One VPS and one public IP can serve many domains over HTTPS. Point every domain to the VPS, give each hostname its own Nginx server block and document root (or upstream), and install certificates whose names cover the hostnames. Nginx uses the requested hostname and TLS Server Name Indication (SNI) to select the correct site and certificate.

The reliable order is DNS and firewall first, HTTP site blocks second, certificate issuance third, HTTPS blocks fourth, and redirects and renewal checks last. Keeping those stages separate makes certificate errors and routing mistakes much easier to diagnose.

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 one VPS serves several HTTPS domains

Name-based virtual hosting lets multiple sites share one IPv4 address. A browser sends the hostname in the HTTP request; during the TLS handshake it also sends that hostname through SNI. Nginx compares it with each server_name, chooses the matching HTTPS server block, presents that block’s certificate, and then serves the site’s files or proxies the request to its application.

There is no requirement for one VPS, one IP address, or one Nginx process per domain. The non-negotiable requirement is that every hostname resolves to the machine and that every HTTPS hostname is present in the certificate selected for it. If either condition is missing, users see the wrong site, a default certificate, or a browser name-mismatch warning.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Plan the domains, roots and upstreams

Before editing Nginx, make a small map of the sites you intend to host. Separate roots keep deployments, permissions and logs understandable; separate reverse-proxy targets keep application failures from being confused with static-file failures.

Hostname Content or application Example location Certificate approach
example.com and www.example.com Static marketing site /var/www/example.com/public One certificate containing both names, or separate certificates
example.net Application behind a local service http://127.0.0.1:3000 Certificate containing example.net
shop.example.org Another virtual host or upstream http://127.0.0.1:8080 Certificate containing shop.example.org

Decide whether www is an alias, a redirect, or a separate site. Put every hostname that should answer in the relevant server_name directive and in the certificate’s Subject Alternative Name list.

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.

Prerequisites: DNS, ports and a working Nginx installation

Point every DNS record at the VPS

Create an A record for each hostname that should use the VPS. If the VPS has working IPv6, create matching AAAA records and ensure IPv6 traffic reaches the same Nginx instance. A stale A or AAAA record is enough to send a browser or an ACME validation server to a different machine.

Check from a system outside the VPS that each name resolves to the intended addresses. Do this before requesting a certificate; certificate authorities validate the public DNS result, not the address you expected to use.

Allow the validation and HTTPS ports

Permit inbound TCP 80 and 443 in both the VPS firewall and any upstream network firewall. HTTP-01 validation retrieves a token over port 80, so a certificate request fails when that port is blocked even if HTTPS already works. Keep port 80 reachable for renewals unless you deliberately use DNS validation instead.

Install Nginx and Certbot

Use your distribution’s packages for Nginx and Certbot, including the Nginx integration package when your distribution provides one. The exact package names vary by operating system. Confirm that Nginx starts and that you can run its configuration test before adding sites.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Create one HTTP server block per domain

Start with port 80. This gives Nginx an unambiguous place to serve ACME challenge files and lets you verify hostname routing before TLS is involved. The following static-site example uses two names:

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;

    root /var/www/example.com/public;
    index index.html;

    location ^~ /.well-known/acme-challenge/ {
        default_type text/plain;
        try_files $uri =404;
    }

    location / {
        try_files $uri $uri/ =404;
    }
}

Save a separate block for each site, changing server_name and root. Do not put unrelated domains into one block simply because they share a VPS; separate files make logs, ownership and certificate mapping explicit.

Use a reverse proxy when the site is an application

A dynamic application generally needs a proxy target rather than a filesystem root:

server {
    listen 80;
    listen [::]:80;
    server_name example.net;

    location ^~ /.well-known/acme-challenge/ {
        default_type text/plain;
        try_files $uri =404;
    }

    location / {
        proxy_pass http://127.0.0.1:3000;
        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;
    }
}

The ACME location must be reachable from the HTTP server block that answers the requested hostname. If a different block, application router or default site captures that path, HTTP-01 authorization fails.

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

Enable and test the files

Distribution layouts differ, but the usual pattern is to place files under /etc/nginx/sites-available/, link the intended files into /etc/nginx/sites-enabled/, and remove or disable an unwanted default site. Test before reloading:

sudo nginx -t
sudo systemctl reload nginx

Request each HTTP hostname and verify that it reaches its own root or upstream. A correct HTTP result proves hostname matching and basic connectivity before certificates add another layer.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Choose a certificate arrangement

Arrangement Best fit Advantages Trade-offs
Separate certificate per domain Domains managed by different people or with different lifecycles Revocation, rotation and troubleshooting stay isolated; one failure has a smaller blast radius More certificate objects and renewal entries to track
One SAN certificate with several names A small group of domains controlled together Fewer certificate objects and renewal operations; Certbot accepts multiple -d names in one request Adding or removing one name changes a shared certificate and couples the domains
Wildcard certificate Many subdomains under one registrable domain One certificate can cover matching first-level subdomains It does not cover unrelated domains or deeper labels automatically; issuance normally uses DNS validation

A wildcard such as *.example.com covers app.example.com but not example.com itself and not a.b.example.com. Include the apex name explicitly when it must work. Wildcards never cover a different registrable domain such as example.net.

Obtain certificates with Certbot

Use the Nginx installer for ordinary sites

Once DNS, port 80 and the HTTP blocks work, Certbot can request and install certificates for named hosts. A multi-name request looks like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo certbot --nginx -d example.com -d www.example.com -d example.net

For operational isolation, run separate requests instead:

sudo certbot --nginx -d example.com -d www.example.com
sudo certbot --nginx -d example.net

The Nginx installer may add HTTPS directives and redirects. Review the resulting files rather than assuming every distribution uses identical formatting. Confirm that each certificate’s names match the hostnames in its server block.

Use certonly when you want manual control

certonly obtains the certificate without asking Certbot to rewrite the virtual host. This is useful when you maintain a carefully structured configuration or use a deployment system:

sudo certbot certonly --webroot -w /var/www/example.com/public -d example.com -d www.example.com

With webroot validation, the token is written below .well-known/acme-challenge in the specified root. The correct HTTP server block must serve that directory for every requested name. If port 80 cannot be made reachable, use DNS validation and create the required DNS challenge records through your DNS provider.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Build the HTTPS server blocks

After issuance, create or review a port-443 block for every site. Each block needs TLS enabled, the exact hostname list, and the certificate files belonging to those names.

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

    root /var/www/example.com/public;
    index index.html;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    location / {
        try_files $uri $uri/ =404;
    }
}

An application block uses the same certificate directives but proxies its requests:

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name example.net;

    ssl_certificate /etc/letsencrypt/live/example.net/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.net/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:3000;
        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;
    }
}

Keep the private key readable by Nginx but not by ordinary site users. If several sites have different administrators, separate certificate directories and Unix permissions reduce accidental disclosure.

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

Redirect HTTP without breaking renewal

After HTTPS works, change each port-80 block so normal requests receive a permanent redirect while the ACME path remains available when HTTP-01 is your renewal method:

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;

    location ^~ /.well-known/acme-challenge/ {
        default_type text/plain;
        try_files $uri =404;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

Preserving $host and $request_uri sends each domain to its own HTTPS URL and keeps the path and query string. Test the challenge path after adding the redirect; a redirect that bypasses the intended webroot can cause authorization failures.

Reload safely and verify every hostname

  1. Run sudo nginx -t. Do not reload if the test reports a syntax error, duplicate directive or missing certificate file.
  2. Reload with sudo systemctl reload nginx so existing connections are not needlessly dropped.
  3. Open every apex name, alias and subdomain in an HTTP client. Confirm that each one reaches the expected files or application, not merely that it returns a 200 status.
  4. Inspect the presented certificate and chain. From a shell, an SNI-aware check is openssl s_client -connect example.com:443 -servername example.com; examine the certificate names and issuer in the output.
  5. Repeat the check with the IP address and each hostname if you suspect a default-server problem. Testing without -servername can intentionally show the default certificate rather than the certificate a browser would receive.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Diagnose the wrong certificate or wrong site

Certificate name mismatch

A browser error such as NET::ERR_CERT_COMMON_NAME_INVALID means the certificate presented does not cover the requested hostname. Check that the name appears in the certificate SAN list, that the HTTPS block contains the same name in server_name, and that its ssl_certificate path points to the intended certificate. SNI allows many certificates on one IP, but only when the hostname-to-block mapping is correct.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

The default HTTPS server is answering

Nginx uses a default server when no server_name matches, and an explicitly configured default can capture traffic intentionally or accidentally. Remove an unused default site or configure it deliberately. Look for a port-443 block marked as the default and for spelling, punctuation or alias omissions in the requested hostname.

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

ACME authorization fails

  • Verify that public DNS still points to this VPS, including the AAAA record.
  • Confirm that TCP 80 is allowed and that the exact /.well-known/acme-challenge/ URL reaches the expected root.
  • Check that another virtual host, redirect rule or application is not consuming the challenge request.
  • Use DNS validation when inbound HTTP cannot be exposed or when network policy prevents port 80 access.

Internationalized domain names

Configure the ASCII Punycode form of an internationalized hostname in server_name. Use the corresponding encoded name when requesting and checking the certificate, while users may continue to type the displayed Unicode form in their browsers.

Renewal and configuration changes

Certbot can renew certificates and, depending on the operating system, may install a timer or scheduled job. Timer names, hooks and service-reload behavior differ by distribution and deployment method, so inspect what is actually installed rather than assuming a particular scheduler.

  1. List the certificates and their covered names with sudo certbot certificates.
  2. Run a safe renewal simulation with sudo certbot renew --dry-run.
  3. Ensure a successful renewal reloads Nginx. A deploy hook should test the new configuration and then reload, for example nginx -t && systemctl reload nginx.
  4. After changing a server block or adding a hostname, repeat the dry run and inspect the live certificate from outside the VPS.

A renewed file on disk is not necessarily the certificate currently served: Nginx must reload to read the replacement. Conversely, a failed reload can leave the old certificate active while the renewal job reports an error. Monitor renewal logs and treat a failed configuration test as an operational incident.

Operational practices that prevent cross-domain incidents

  • Keep files separate. Use one configuration file, root or upstream definition and log path per site where practical.
  • Use explicit names. Include every intended alias in both server_name and the certificate request; do not rely on a catch-all block to serve production domains.
  • Record ownership. Document who controls each DNS zone, certificate and application so an expired delegation does not block renewal.
  • Back up configuration and content. A VPS snapshot alone may not preserve external DNS records or certificate-account credentials.
  • Limit blast radius. Use separate certificates when domains have different administrators, risk profiles or release schedules; use a SAN certificate when centralized management is more valuable than isolation.
  • Watch both IPv4 and IPv6. A correct A record cannot compensate for an AAAA record that points to an old server.
  • Test after every change. Run the Nginx configuration test, reload, then check each hostname and its certificate rather than testing only the site you edited.

When a single VPS is the right boundary

Sharing a VPS is technically straightforward for independent low- and medium-traffic sites, but all domains share the machine’s CPU, memory, kernel, network path and administrative boundary. A runaway application can exhaust resources for every virtual host, and a compromise of the operating system can expose all sites. Separate VPS instances or stronger isolation become appropriate when domains require independent security ownership, availability targets or maintenance windows.

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

Those infrastructure decisions do not change the TLS model: each public hostname still needs correct DNS, a matching Nginx name, and a certificate that covers it. What changes is the blast radius when the shared machine or its configuration fails.

Practical completion checklist

  • Every A and AAAA record resolves to the intended VPS.
  • TCP 80 and 443 are allowed through all firewalls.
  • Each hostname has a distinct HTTP and HTTPS server_name mapping.
  • Static roots and reverse-proxy targets point to the intended site.
  • Each certificate SAN list covers every hostname in its HTTPS block.
  • The ACME challenge path works before and after the HTTP redirect.
  • nginx -t passes before every reload.
  • External checks show the expected certificate, chain, content and upstream for every domain.
  • A renewal dry run succeeds and a renewal triggers an Nginx reload.

The Bottom Line

Host as many domains as the VPS can reliably support by combining DNS, separate Nginx virtual hosts and correctly scoped certificates. Name-based routing and SNI let one IP present the right certificate; disciplined validation, testing and renewal automation keep that arrangement dependable.

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 quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.