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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Lighttpd can serve different HTTPS certificates for multiple domains on one IP address by using TLS Server Name Indication (SNI). Enable TLS on the :443 socket, assign a deliberate default certificate there, then override ssl.pemfile and ssl.privkey inside a $HTTP["host"] conditional for every additional hostname. During the TLS handshake, an SNI-capable client sends the hostname it wants; Lighttpd uses that name to select the corresponding certificate.

The default certificate remains essential. A client may omit SNI, or a request may use a hostname for which no conditional exists. In either case, Lighttpd presents the certificate configured on the HTTPS socket, so choose that fallback deliberately and test it.

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

How Lighttpd chooses a certificate

HTTPS begins with a TLS handshake, before the HTTP request is available. SNI is a TLS extension that lets the client send the requested hostname during that handshake. Lighttpd can use the hostname to select a certificate while several domains share the same IP address and port.

Lighttpd’s configuration has two levels in this arrangement:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
  • The $SERVER["socket"] == ":443" block enables TLS and defines the fallback certificate.
  • Each $HTTP["host"] conditional overrides the certificate files for one hostname.

This is different from selecting a certificate after ordinary HTTP routing. The certificate must be available at handshake time, which is why the hostname conditionals and their spelling matter. A request for example.org is not the same match as www.example.org; configure both when both names are used.

What you need before changing the configuration

  • A Lighttpd build with mod_openssl available and loaded.
  • An HTTPS listener on port 443 and a reachable DNS record for every hostname.
  • A certificate and matching private key for each independently issued hostname or certificate set.
  • Readable certificate files and private keys with permissions that allow the Lighttpd process to open them while keeping private keys restricted.
  • A plan for the default certificate presented to SNI-less clients and unknown hostnames.
  • If using HTTP-01 validation with Let’s Encrypt, an HTTP service on port 80 that can answer the challenge for the hostname.

Check the installed Lighttpd version before copying directives. The official references place the ssl.* directives in mod_openssl from Lighttpd 1.4.46 onward and identify ssl.privkey as available from 1.4.53.

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.

Build the shared HTTPS socket

Start with one socket block. It turns on TLS and defines the certificate that Lighttpd will use when no more specific host match supplies another one.

server.modules += ("mod_openssl")

$SERVER["socket"] == ":443" {
    ssl.engine = "enable"
    ssl.pemfile = "/etc/lighttpd/ssl/default.example.pem"
    ssl.privkey = "/etc/lighttpd/ssl/default.example.key"
}

ssl.engine = "enable" activates TLS for the socket. ssl.pemfile points to the server certificate file, and ssl.privkey points to the private key when that key is not embedded in the PEM file.

The default certificate is not optional in a multi-certificate design. It is the certificate used when the client does not send SNI and the certificate used when no host conditional matches. Pick a hostname whose certificate is an intentional fallback, rather than leaving an arbitrary or expired certificate in that role.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Add one host conditional per additional name

After the socket block, add a conditional for each hostname that needs a different certificate. The hostname must match the value sent by the client, and the paths must point to the certificate and key issued for that name.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
$HTTP["host"] == "www.example.org" {
    ssl.pemfile = "/etc/lighttpd/ssl/www.example.org/fullchain.pem"
    ssl.privkey = "/etc/lighttpd/ssl/www.example.org/privkey.pem"
}

$HTTP["host"] == "mail.example.org" {
    ssl.pemfile = "/etc/lighttpd/ssl/mail.example.org/fullchain.pem"
    ssl.privkey = "/etc/lighttpd/ssl/mail.example.org/privkey.pem"
}

With this arrangement, a client that sends www.example.org in SNI receives the first certificate, while a client that sends mail.example.org receives the second. Any unmatched name falls back to the certificate in the :443 block.

Keep the conditionals unambiguous. Use the exact DNS name, including the www prefix when it is part of the URL. If users can reach both an apex name and its www form, provide a certificate covering both names or create separate matching rules as appropriate to the certificates you obtained.

Certificate and key file requirements

Put the chain in the correct order

Lighttpd’s ssl.pemfile must contain the server certificate and, when applicable, the intermediate certificates in the correct order. For a separately issued certificate, the common deployment pattern is a file containing the leaf certificate followed by its intermediate chain. A browser or command-line client can then build a trusted path without fetching an intermediate from elsewhere.

Keep the private key separate when needed

If the private key is not inside the PEM file, set ssl.privkey to the corresponding key file. The key must match the public key in the certificate selected for that hostname. Do not pair a key from one domain with the certificate from another; Lighttpd may fail to start or the TLS handshake may fail.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Use a complete, matching set for each host

For every conditional, verify all three relationships: the conditional’s spelling matches the requested hostname, the PEM contains the certificate for that hostname, and the private key belongs to that certificate. A certificate that covers only the apex domain will not automatically cover www, and the reverse is also true unless both names are included in the certificate’s names.

Complete two-domain example

The following configuration uses one fallback certificate and two host-specific certificates. Adapt paths and names to your own layout.

server.modules += ("mod_openssl")

$SERVER["socket"] == ":443" {
    ssl.engine = "enable"
    ssl.pemfile = "/etc/lighttpd/ssl/default.example.pem"
    ssl.privkey = "/etc/lighttpd/ssl/default.example.key"
}

$HTTP["host"] == "www.example.org" {
    ssl.pemfile = "/etc/lighttpd/ssl/www.example.org/fullchain.pem"
    ssl.privkey = "/etc/lighttpd/ssl/www.example.org/privkey.pem"
}

$HTTP["host"] == "mail.example.org" {
    ssl.pemfile = "/etc/lighttpd/ssl/mail.example.org/fullchain.pem"
    ssl.privkey = "/etc/lighttpd/ssl/mail.example.org/privkey.pem"
}

The socket block supplies the fallback. The two host conditionals replace only the certificate settings for their matching names; the TLS engine remains enabled by the socket configuration.

Using Let’s Encrypt certificates

Lighttpd’s official how-to documents Certbot and Let’s Encrypt. Its example maps privkey.pem to ssl.privkey and fullchain.pem to ssl.pemfile, and sets a minimum TLS protocol of TLS 1.2 through the OpenSSL configuration command.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
server.modules += ("mod_openssl")

$SERVER["socket"] == "0.0.0.0:443" {
    ssl.engine = "enable"
    ssl.privkey = "/etc/letsencrypt/live/www.example.com/privkey.pem"
    ssl.pemfile = "/etc/letsencrypt/live/www.example.com/fullchain.pem"
    ssl.openssl.ssl-conf-cmd = ("MinProtocol" => "TLSv1.2")
}

For multiple domains, apply the same file mapping to each host conditional, using the directory and certificate names produced for that hostname or certificate set. The exact paths depend on how Certbot issued the certificates.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Make HTTP-01 validation reachable

HTTP-01 validation requires the hostname to answer the challenge on port 80. Ensure DNS points the name to this server, the firewall permits port 80, and Lighttpd (or the validation routing you configured) serves the challenge location. A certificate configuration on port 443 cannot by itself satisfy an HTTP-01 challenge.

Reload after renewal

Certificate files can change when Certbot renews them, but the running Lighttpd process must be reloaded or restarted according to your deployment’s process before it presents the new certificate. After the operation, connect to each hostname and inspect the certificate actually served; do not assume that updated files were picked up automatically.

Validate the configuration before and after enabling it

  1. Confirm that mod_openssl is loaded in the Lighttpd configuration.
  2. Check that the HTTPS socket is the one receiving traffic on port 443 and that it contains ssl.engine = "enable".
  3. Confirm that the socket has a readable default ssl.pemfile and, when separate, a readable default ssl.privkey.
  4. Review every $HTTP["host"] conditional character by character. Check apex versus www, spelling, punctuation and certificate path.
  5. Run your distribution’s Lighttpd configuration test before reloading the service. A syntax or file-read error should be fixed before replacing the running process.
  6. Verify that every PEM contains the leaf certificate and the required intermediate chain in order, and that each private key matches its certificate.
  7. Connect separately using every configured hostname and inspect the presented certificate and chain. The certificate subject or covered names should correspond to the hostname you tested.
  8. Test an intentionally unknown hostname and, where possible, an SNI-less client. Confirm that the deliberate default certificate appears rather than an expired or unrelated certificate.
  9. If you use Certbot’s HTTP-01 method, request a challenge or otherwise verify that port 80 routes the challenge correctly.

Testing each name separately matters because a successful connection to one hostname proves only that one conditional and certificate chain work. It does not prove that another conditional is spelled correctly or that its key matches.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

The wrong certificate appears for a known hostname

  • Check whether the client actually sent SNI. Older clients and some specialized probes may omit it.
  • Compare the requested hostname with the exact text in the $HTTP["host"] conditional. An apex name and a www name require separate matching logic unless one certificate and rule intentionally cover both.
  • Confirm that the request reaches the expected IP address. DNS pointing to another server will produce that server’s certificate, regardless of this configuration.
  • Check that the host-specific files are readable and that the daemon was reloaded after a configuration or certificate change.

Lighttpd will not start or reload

  • Inspect the configuration-test output for syntax errors, missing files and permission failures.
  • Verify that mod_openssl is installed and loaded and that the running Lighttpd version supports the directives you used.
  • Check the PEM and private-key pairing. A mismatched key can prevent certificate initialization.
  • Look for an incorrect certificate-chain file. The server certificate and intermediates must be present in the expected order.

Browsers report an incomplete or untrusted chain

Rebuild the ssl.pemfile with the leaf certificate followed by the required intermediate certificates. Supplying only the leaf certificate can leave clients unable to construct the trust chain, even when the certificate itself is valid.

Renewed certificates are not visible

Check the timestamps and contents of the files referenced by Lighttpd, then reload or restart the daemon as required by your process. Test the live endpoint afterward; checking files on disk alone does not prove which certificate the running process has loaded.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

SNI on one IP versus separate IP addresses

SNI is the scalable option when several HTTPS names share an address. The historical alternative is to assign one IP address per domain and bind each certificate to a separate $SERVER["socket"] block.

Consideration SNI with host conditionals Separate IP addresses
Client compatibility Requires the client to send the hostname in SNI; SNI-less clients receive the default certificate. Works with clients that do not send SNI because each address has its own certificate.
Address use Several hostnames share one IP and port, conserving IPv4 addresses. Requires an address for each certificate or domain.
Certificate selection Uses the default socket certificate plus $HTTP["host"] overrides. Binds a certificate directly to each socket.
Failure behavior An omitted or unmatched hostname receives the deliberate default certificate. The address itself determines which certificate is presented.
Operations One HTTPS listener with certificate paths maintained in host conditionals. Multiple socket definitions and address assignments to maintain.

Choose separate addresses only when compatibility with non-SNI clients is a hard requirement and the additional address space is available. For modern HTTPS hosting, SNI avoids that address cost, but it makes the default certificate and hostname conditionals operationally important.

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

Version and inheritance considerations

The official Lighttpd references describe ssl.* directives in mod_openssl from version 1.4.46 onward and ssl.privkey from 1.4.53. Later documentation also discusses inheritance and certificate-refresh behavior. Because directive support and reload behavior can vary by installed release, compare your version with the matching Lighttpd reference before deploying a copied example.

Do not infer support solely from the configuration syntax. Confirm the module is present, test the complete configuration with the installed binary, and verify the live certificate after every reload or renewal.

Operational practices that prevent outages

  • Keep certificate and key paths organized by hostname so a conditional cannot accidentally reference another domain’s files.
  • Use a known-valid fallback certificate and monitor its expiration separately from the host-specific certificates.
  • Restrict private-key permissions and avoid placing keys in web-accessible directories.
  • Automate renewal only together with a tested reload step; issuance without reload leaves the old certificate active.
  • Retest every hostname after adding, removing or renaming a conditional, and include an unknown-name test to verify fallback behavior.
  • Document whether each certificate covers an apex name, a www name, or both, so DNS and Lighttpd rules remain aligned.

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.