October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober 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 Set Up Let’s Encrypt SSL with Nginx Server Blocks

A practical guide to installing and renewing Let's Encrypt certificates on Nginx, with correct port-80 challenge handling, 443 SSL blocks, Certbot choices, validation steps, and failure fixes.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To secure an Nginx site with Let’s Encrypt, point the domain’s DNS records at the server, make ports 80 and 443 reachable, create an HTTP server block whose server_name matches the requested names, and run sudo certbot --nginx. Certbot can obtain the certificate and edit Nginx for you. If you need to review every directive yourself, use sudo certbot certonly --nginx, then add the 443 SSL block manually. In either case, keep an HTTP listener on port 80 so HTTP-01 validation and normal web traffic continue to work, test the configuration with sudo nginx -t, and reload Nginx only after the test succeeds.

What must be in place before Certbot runs

Let’s Encrypt’s Nginx integration normally uses the HTTP-01 challenge. A validation server requests a token at http://your-domain.example/.well-known/acme-challenge/<TOKEN>. For that request to succeed, the public DNS name must resolve to this Nginx host and the host must accept inbound TCP connections on port 80. The final site also needs port 443 open for HTTPS.

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.
  • DNS: Create an A record for the server’s IPv4 address. If the domain has an AAAA record, it must point to an IPv6 address that reaches the same Nginx configuration; an incorrect AAAA record can make validation fail even when IPv4 works.
  • Network access: Permit TCP 80 and 443 in the operating-system firewall, cloud security group, load balancer, and any NAT rule in front of the server.
  • Nginx: Have an HTTP site online before invoking the standard Nginx or webroot flow. The requested host names must appear in the relevant server_name directive.
  • Privileges: Certbot needs permission to read and write Nginx configuration and to place certificates under its managed directory, so run the commands with sudo.

Do not start by deleting the port-80 listener. HTTP-01 is designed around that listener, and keeping it available also lets you redirect ordinary HTTP requests to HTTPS after issuance.

“Our recommendation is that all servers meant for general web use should offer both HTTP on port 80 and HTTPS on port 443.” — Let’s Encrypt

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

Create and check the initial HTTP server block

Before a certificate exists, define a server block that can answer the domain over plain HTTP. Use the exact names you intend to place on the certificate, including or excluding www deliberately. The root shown below is an example; substitute your site’s document root or replace the request handler with your reverse-proxy settings.

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

    root /var/www/example;

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

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

The separate challenge location makes the intended validation path explicit. If your application is proxied, keep the challenge location pointed at a local directory instead of sending those requests to an application that might authenticate, rewrite, or block them. The remaining location can proxy to the application or serve files according to your deployment.

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

Enable the file using your distribution’s normal Nginx site-management method, then run:

sudo nginx -t

Fix every syntax or file-path error reported by the test. Reload only after it passes:

sudo systemctl reload nginx

From a network outside the server, request the HTTP URL with each intended host name. Confirm that the request reaches this machine, rather than a parking page, an old load balancer, or a different virtual host. A redirect to HTTPS is acceptable for ordinary paths, but the challenge path must remain publicly retrievable.

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

Choose Certbot’s Nginx workflow

Certbot’s Nginx plugin can act as both an authenticator and an installer. The choice below determines how much of the resulting configuration Certbot changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Command or method What it does When it fits Important condition
sudo certbot --nginx Obtains the certificate through Nginx and edits the server blocks to install it, commonly offering an HTTP-to-HTTPS redirect choice. Fast setup when the generated directives match your deployment. Port 80, DNS, and the existing HTTP site must be reachable during validation.
sudo certbot certonly --nginx Uses the Nginx plugin to complete validation and obtain the certificate but leaves installation and final server-block editing to you. Sites with carefully reviewed proxy rules, redirects, or a configuration-management process. You must add the 443 listener and certificate paths, test, and reload Nginx yourself.
DNS-01 with a Certbot DNS plugin or controlled TXT record Proves control by publishing a DNS TXT record instead of serving a file over HTTP. Wildcard certificates or servers that cannot expose port 80. You need DNS API access or the ability to create the required TXT record; this is a different validation flow.

For a conventional web server, start with sudo certbot --nginx. Certbot will discover names from the active Nginx configuration and ask which should be included. Select only names that resolve to this host and that you are prepared to serve. If you want a controlled change review, use the certonly form and perform the installation in the next section.

Wildcard names such as *.example.com cannot be issued with HTTP-01. Certbot identifies DNS plugins as the route to wildcard certificates, and DNS validation does not require inbound access to the web server. You still need to configure the resulting certificate in Nginx after issuance.

Inspect or write the HTTPS server block

After successful issuance, the HTTPS virtual host must listen on port 443 with SSL enabled and reference both the full certificate chain and the private key. A minimal file-serving example is:

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

    root /var/www/example;
    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;
    }
}

Replace the root and request handling with the directives used by your application. The key requirements are the SSL-enabled 443 listeners and certificate/key paths. The live paths shown are Certbot-managed locations; retaining them avoids having to copy renewed files manually. The certificate name in the path may differ when Certbot has to disambiguate multiple certificates, so inspect the paths it actually reports rather than assuming the directory name.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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)

When Certbot has edited the file automatically, review the resulting block instead of treating the change as opaque. Check that every requested name appears in server_name, that the certificate covers those names, and that your original proxy, WebSocket, upload, and application rules remain in the intended virtual host. Automatic installation is convenient, but a manual review catches a redirect or proxy change that is syntactically valid yet operationally wrong.

Keep HTTP for redirects and future validation

The port-80 block should continue to exist after HTTPS is working. For normal requests, redirecting with return 301 https://$host$request_uri; preserves the host and path. Do not apply a blanket rule that prevents access to /.well-known/acme-challenge/. During HTTP-01, Let’s Encrypt follows redirects only to HTTP or HTTPS on ports 80 or 443, so a redirect to an unrelated port, an IP address, or a private hostname will not satisfy the challenge.

If you prefer Certbot’s automatic redirect option, inspect the generated result and verify that the challenge location remains reachable. If you write the redirect yourself, put the challenge exception before any broad deny, authentication, rewrite, or proxy rule that could intercept it. This matters on every renewal, not only on the first issuance.

Validate safely and test both protocols

  1. Run the configuration test: sudo nginx -t. A successful result confirms that Nginx can parse the files and open the referenced certificate and key.
  2. Reload without dropping connections: sudo systemctl reload nginx, or use the equivalent reload operation supplied by your platform.
  3. Check each hostname externally: Visit both http:// and https:// forms for every name on the certificate. Confirm that HTTP redirects as intended and HTTPS serves the expected site.
  4. Inspect the certificate: Use the browser’s certificate viewer or another external TLS inspection method to verify the subject names, validity dates, and issuing chain. Check the name users actually type, not just the first name in the certificate.
  5. Exercise the challenge path: Place a temporary test file in the directory mapped to /.well-known/acme-challenge/ and request that exact URL over HTTP from outside the server. Remove the file after confirming the mapping. The response must come from this Nginx host and must not be blocked or rewritten to an application login page.

If the test command fails after an automated Certbot run, do not reload blindly. Read the reported file and line, correct the duplicate listener, missing semicolon, or incorrect path, and run sudo nginx -t again. A reload is safe only when Nginx reports a valid configuration.

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

Make renewal automatic and observable

Let’s Encrypt certificates are short-lived, so issuance is only half of the job. Certbot packages normally install a scheduled cron job or systemd timer that attempts renewal before expiry. Confirm that the scheduled job exists on your system and that it runs under the same installation that owns the live certificate paths.

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

Renewal must also reach the challenge endpoint. Keep DNS records current, leave port 80 open, and preserve the challenge location when editing redirects or application rules. If you used certonly and maintain Nginx configuration yourself, make sure a successful renewal is followed by an Nginx reload; otherwise Nginx may continue serving the previous certificate even though Certbot has written a new file.

Run the renewal test recommended by your Certbot package before relying on the schedule. Check the job’s logs for a successful simulated renewal and verify that the service account can read the managed files. A timer that exists but cannot reload Nginx, reach DNS, or write its log is not an operational renewal system.

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

Troubleshoot HTTP-01 failures by symptom

The domain resolves to the wrong machine

Review the A and AAAA records from a network outside your hosting environment. An old A record, a proxy service, or an AAAA record pointing to an unconfigured IPv6 listener can send the validation request elsewhere. Correct the record, wait for the change to propagate, and verify that both address families reach the Nginx host before running Certbot again.

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.

Port 80 is blocked

Check every layer: the local firewall, cloud security group, router or NAT rule, and any upstream load balancer. Certbot’s standard Nginx flow expects an HTTP site reachable from the Internet. Opening only port 443 does not satisfy HTTP-01.

The challenge returns a redirect, 403, or application page

Request the exact /.well-known/acme-challenge/ URL and inspect which server block handles it. A broad redirect, access rule, authentication middleware, or proxy location may be taking precedence. Create an explicit challenge location, ensure its root contains the requested token, and keep it outside rules intended for the application.

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.

Another process owns port 80

Standalone validation needs to bind the port itself and therefore cannot start while another service owns it. The Nginx plugin works with the running web server, and webroot-style validation places the token in an already-served directory. If you deliberately choose standalone mode, stop the conflicting service for validation and start it again afterward; otherwise use the Nginx or webroot approach to avoid that replacement workflow.

The certificate is issued but Nginx will not reload

Run sudo nginx -t and read the first reported error. Common causes include a certificate path that does not match the name Certbot created, a private-key permission problem, duplicate listen 443 ssl declarations with conflicting settings, or a copied path that points outside Certbot’s managed locations. Restore the correct paths, test again, and only then reload.

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

A wildcard request fails immediately

HTTP-01 cannot validate wildcard names. Switch to DNS-01 with a suitable DNS plugin or publish the required TXT record manually. This proves DNS control and does not depend on a web server accepting inbound port-80 traffic, but it requires reliable DNS administration and careful handling of API credentials or TXT records.

Automatic installation versus manual server-block control

The automatic command is appropriate when the site has a straightforward Nginx layout and you want Certbot to add the certificate directives and redirect. It reduces typing and gets a conventional site online quickly. The trade-off is that a tool-generated edit may not reflect the routing, caching, authentication, or multi-tenant policy you want to enforce.

The certonly workflow separates identity validation from configuration deployment. It is preferable when Nginx files are managed from a reviewed template, when several applications share a host, or when you need to decide exactly which block receives each certificate. You assume responsibility for inserting listen 443 ssl, the certificate paths, the redirect behavior, and the post-renewal reload.

Neither workflow changes the underlying validation requirements. DNS must still identify the correct host, port 80 must remain reachable for HTTP-01, and the challenge URL must survive future configuration changes. The practical decision is who edits the server blocks and who owns the reload step after renewal.

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

Operational checklist

  • Every A and AAAA record for the requested names points to this deployment.
  • Inbound TCP 80 and 443 are allowed at the host and hosting-provider firewalls.
  • The HTTP block contains the exact server_name values and serves /.well-known/acme-challenge/.
  • You selected --nginx for automatic installation or certonly --nginx for manual installation intentionally.
  • The HTTPS block listens on 443 with SSL and references the actual Certbot-managed fullchain.pem and privkey.pem paths.
  • sudo nginx -t passes before every reload.
  • External tests cover both HTTP redirects and HTTPS responses for every certificate name.
  • A packaged cron job or systemd timer is present, its renewal test succeeds, and any custom deployment reloads Nginx after renewal.

Following that sequence gives Certbot a reachable validation endpoint, gives Nginx a clear 443 configuration, and leaves port 80 available for the next renewal instead of treating certificate issuance as a one-time change.

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