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 DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Set Up Multiple SSL Certificates on One IP With Nginx

Use TLS SNI and one NGINX HTTPS server block per hostname to serve multiple SSL certificates from a single IP. This guide covers certificate files, defaults, validation, troubleshooting, SAN and wildcard alternatives, and compatibility limits.
Length9 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.

NGINX can serve several HTTPS domains from one IP address by using TLS Server Name Indication (SNI). Create one server block per hostname, keep the same listen 443 ssl; endpoint in each block, and assign each block its own certificate and private key. The client sends the requested hostname during the TLS handshake, allowing NGINX to select the matching certificate.

What makes multiple certificates work on one IP

HTTPS normally begins with a TLS handshake, before NGINX receives an HTTP request. At that point the server needs to know which certificate to present. TLS SNI solves the problem by allowing the client to include the hostname it intends to visit in the handshake.

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.

NGINX uses that name to choose among HTTPS virtual servers bound to the same address and port. After the handshake, normal HTTP routing continues: NGINX can use the request line and the HTTP Host header to select the server that handles the application request. The TLS decision and the later HTTP decision should therefore agree on the hostname.

NGINX initially creates a connection in a default-server context. If the client sends SNI, NGINX can switch to the virtual server whose server_name matches that value and present that server’s certificate. If the client sends no SNI, uses a name that does not match, or connects by literal IP address, NGINX may present the certificate belonging to the default server instead.

#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.

This is why a second domain can appear to have the wrong certificate even when its configuration exists: the client may not have supplied SNI, the name may not match exactly, or the intended configuration may not have been loaded.

Prerequisites and compatibility checks

Confirm NGINX and OpenSSL support SNI

Check the compiled NGINX features before changing configuration:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
nginx -V 2>&1

Review the output for the SNI support indication described in NGINX’s documentation. SNI support is documented from NGINX 0.5.23 onward. The ssl parameter on the listen directive is documented from NGINX 0.7.14 onward.

Also verify that the OpenSSL library used at runtime supports SNI. A dynamically linked library without the required TLS extension support can prevent SNI from working even when the NGINX binary itself was built with the feature.

Prepare DNS and certificate names

Each public hostname must resolve to the address where NGINX accepts HTTPS connections. More importantly, the hostname written in server_name must exactly match a name in that certificate’s Subject Alternative Name (SAN) set. A certificate for www.example.com does not automatically cover example.com, and a certificate for one unrelated domain cannot be made correct by changing NGINX configuration.

Plan the file layout and permissions

Keep each site’s certificate and key in a predictable directory, for example:

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
/etc/nginx/tls/www.example.com/fullchain.pem
/etc/nginx/tls/www.example.com/privkey.pem
/etc/nginx/tls/www.example.org/fullchain.pem
/etc/nginx/tls/www.example.org/privkey.pem

The NGINX master process must be able to read the files when it starts or reloads. Private keys should remain readable only by the account or group that requires them; do not make key files broadly readable just to overcome a permissions error.

Build each certificate PEM correctly

For every hostname, the file named by ssl_certificate should contain the leaf certificate first, followed by the intermediate certificates that form the chain. This combined PEM is commonly called a full chain. Put the matching private key in the file named by ssl_certificate_key.

Do not swap a key between sites. NGINX must be able to pair each certificate with its corresponding private key, and the certificate itself must contain the requested hostname in its SAN set. A valid certificate for the wrong name is still the wrong certificate.

When several servers genuinely use one common certificate and key, the directives can be placed at http scope so the servers inherit them and NGINX keeps one memory copy. That optimization is appropriate only when the same certificate and key are intended for every inheriting server; separate domains normally need separate paths and separate keys.

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

Configure one HTTPS server block per hostname

Place the following pattern inside the NGINX http context. The two blocks intentionally listen on the same HTTPS endpoint:

http {
    server {
        listen 443 ssl;
        server_name www.example.com;

        ssl_certificate     /etc/nginx/tls/www.example.com/fullchain.pem;
        ssl_certificate_key /etc/nginx/tls/www.example.com/privkey.pem;

        root /srv/www/example-com;
    }

    server {
        listen 443 ssl;
        server_name www.example.org;

        ssl_certificate     /etc/nginx/tls/www.example.org/fullchain.pem;
        ssl_certificate_key /etc/nginx/tls/www.example.org/privkey.pem;

        root /srv/www/example-org;
    }
}

What each directive does

  • listen 443 ssl; enables TLS on port 443. Every HTTPS block in this arrangement uses the same address and port.
  • server_name declares the hostname that NGINX should match during SNI and during HTTP request routing. Use the exact names covered by the certificate.
  • ssl_certificate points to the PEM containing the leaf certificate and its intermediate chain.
  • ssl_certificate_key points to the private key paired with that certificate.
  • root is only an example of per-site content routing; proxy applications can use their own location and upstream configuration instead.

You can add additional domains by copying the block, changing server_name, and assigning the matching certificate paths. Do not put two unrelated certificates in one block and expect NGINX to infer which one to use; certificate selection is tied to the virtual server selected by the hostname.

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 the default server deliberately

When several servers share an address and port, one becomes the default for that listening socket. If no block is marked explicitly, the first matching listen definition is normally used as the default. You can make the choice clear with:

server {
    listen 443 ssl default_server;
    server_name _;

    ssl_certificate     /etc/nginx/tls/default/fullchain.pem;
    ssl_certificate_key /etc/nginx/tls/default/privkey.pem;

    return 444;
}

The default certificate is what a non-SNI client, an unmatched hostname, or a request made directly to the IP address can receive. Select a certificate and response policy for that case intentionally. A default block that closes or rejects unknown names can prevent an unrelated site from being served, but clients that do not send SNI still cannot receive a name-specific certificate from another block.

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

Validate the configuration before reloading

  1. Run nginx -V 2>&1 and confirm that the build and runtime OpenSSL combination supports SNI.
  2. Check every certificate’s SAN list and compare it with the corresponding server_name. Include every name users will actually request, such as both an apex name and a www name when both are used.
  3. Verify that the certificate PEM begins with the leaf certificate and has the required intermediate certificates after it. Confirm that the private key is readable by the NGINX master process but not by unnecessary accounts.
  4. Test syntax and file access with:
nginx -t

Do not reload after a failed test. Fix the reported path, permission, duplicate-listen, or syntax error first.

  1. Reload NGINX through the service manager used by your operating system. A systemd host commonly uses systemctl reload nginx; another platform may use a different service command. The command must perform a reload of the tested configuration rather than restarting an unrelated installation.
  2. Test each hostname with SNI explicitly:
openssl s_client -connect 203.0.113.10:443 -servername www.example.com
openssl s_client -connect 203.0.113.10:443 -servername www.example.org

Inspect the certificate returned by each connection, including its subject, SAN entries, issuer, and chain. The -servername value is essential: without it, the test intentionally behaves like a client that did not send SNI and will commonly show the default certificate.

Why NGINX can show the wrong certificate

The test used a literal IP address

A browser or TLS client connecting to https://203.0.113.10/ has no hostname that identifies one of the virtual servers. NGINX therefore has to use the default-server context. Test with the real hostname, or use openssl s_client with -servername.

The client did not send SNI

Older or otherwise incompatible TLS clients may omit SNI. They can receive only the default certificate when several names share one address. If those clients are a requirement, use separate IP addresses so each HTTPS server has an unambiguous endpoint.

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

server_name and SAN do not match

Check spelling, punctuation, and subdomain depth. A certificate containing www.example.com does not cover example.com unless that apex name is also listed. NGINX can route a request to a block whose certificate does not contain the requested name, but the client will report a hostname-validation error.

The intended block was not loaded

A valid file on disk has no effect until the active NGINX configuration includes it and a successful reload applies it. Run nginx -t, confirm the paths shown in the active configuration, and reload through the correct service manager. If two installations of NGINX exist, make sure the command you test and the service you reload refer to the same installation.

The default block wins during the handshake

Inspect all listen 443 definitions for an unintended default_server assignment or a block that appears first and becomes the implicit default. The default matters whenever SNI is absent or unmatched; it does not replace a correctly matched SNI block.

The certificate chain is incomplete

An incomplete PEM can cause trust errors even when the leaf certificate is the correct one. Rebuild the file with the primary certificate first and the intermediate certificates after it, then retest with openssl s_client. Keep this chain issue separate from hostname selection: adding intermediates does not make a certificate cover a different domain.

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

NGINX cannot read a key or certificate

Permission or path errors appear during configuration testing or reload. Check ownership, directory traversal permissions, and the exact spelling of every filename. Grant the NGINX master process the minimum read access needed for the key and certificate files.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Alternatives to separate SNI certificates

SNI is usually the simplest design when each domain needs an independent certificate, but other arrangements can fit particular naming or compatibility requirements.

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.
Approach Client compatibility Best fit Management considerations Limits
Separate certificates with SNI Requires clients to send SNI Unrelated domains sharing one IP Each hostname has its own PEM, key, renewal, and server block Non-SNI clients receive the default certificate
One SAN certificate One certificate can serve listed names without selecting among separate certificates A known group of exact hostnames managed together One certificate and key to deploy and renew The SAN field has a finite size; every required name must be listed
Wildcard certificate Uses one certificate for matching names Many subdomains at one level, such as *.example.org One certificate can simplify deployment across those subdomains A wildcard covers one subdomain level; it does not cover example.org itself or www.sub.example.org
Separate IP addresses Works for clients that do not send SNI Legacy-client compatibility or strict endpoint separation Each HTTPS service gets an unambiguous address and can retain independent configuration Requires additional addresses and corresponding network allocation

The naming pattern should drive the choice. A SAN certificate is practical when the complete list of exact names is stable. A wildcard is useful only within its single-level scope. Separate IPs are the compatibility fallback when clients cannot send SNI. Independent SNI certificates avoid putting unrelated names and renewal schedules into one certificate.

Advanced NGINX certificate patterns

Different certificate types for the same names

Current NGINX versions can repeat ssl_certificate and ssl_certificate_key for different certificate types, such as RSA and ECDSA, when the available OpenSSL capabilities support them. This lets compatible clients receive an appropriate certificate type while the same hostname remains in one virtual-server design. Test the resulting handshake from the client types you need to support before deploying this arrangement broadly.

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.

Variable certificate filenames

NGINX documents support for variables in certificate filenames from version 1.15.9. Variable paths can support more dynamic layouts, but they add configuration complexity and make file-selection mistakes harder to diagnose. Static, hostname-specific paths are easier to audit for a small set of sites.

Certificate caching

NGINX documents certificate caching from version 1.27.4. Treat this as a version-specific capability rather than a requirement for ordinary SNI configuration. The basic design works with explicit certificate paths in each server block.

Deployment checklist

  • Every HTTPS hostname has its own server block or an intentional shared-certificate design.
  • All blocks use the same intended HTTPS address and port, normally listen 443 ssl;.
  • Each server_name exactly matches a SAN entry in its certificate.
  • Each certificate PEM starts with the leaf certificate and includes the required intermediates.
  • Each private key matches its certificate and has restricted read access.
  • The default server is deliberate for unmatched, literal-IP, and non-SNI connections.
  • nginx -t succeeds before the reload.
  • Every hostname is tested with an SNI-aware command such as openssl s_client -connect 203.0.113.10:443 -servername hostname.example.
  • The service manager reloads the same NGINX installation whose configuration was tested.

With those conditions met, one IP can terminate HTTPS for multiple names cleanly: SNI selects the certificate during the handshake, and the matching HTTP virtual server then serves the requested site.

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.

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

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.