Table of Contents
2. Run Certbot to Get the Certificate
3. Configure HTTPS Settings (Optional but Recommended)
4. Auto-Renewal Setup
5. Verify the Installation
Home Operation and Maintenance Apache How to install a Let's Encrypt SSL certificate on Apache?

How to install a Let's Encrypt SSL certificate on Apache?

Aug 04, 2025 am 09:47 AM
apache

Install Certbot and its Apache plug-in; 2. Run Certbot to obtain the certificate and configure the domain name; 3. Optionally configure automatic redirection from HTTP to HTTPS; 4. Set up automatic renewal and pass dry-run test; 5. Verify the installation and ensure the normal reload configuration of Apache. After the certificate is successfully deployed, renewal will be automatically managed. After the entire process is completed, secure HTTPS access can be achieved.

How to install a Let\'s Encrypt SSL certificate on Apache?

Installing a Let's Encrypt SSL certificate on Apache is straightforward using Certbot, the official tool for managing Let's Encrypt certificates. Here's how to do it on a typical Linux server (eg, Ubuntu/Debian):

How to install a Let's Encrypt SSL certificate on Apache?

1. Install Certbot and the Apache Plugin

First, update your package list and install certbot along with the Apache plugin:

 sudo apt update
sudo apt install certbot python3-certbot-apache

This plugin automatically configures Apache to use the SSL certificate.

How to install a Let's Encrypt SSL certificate on Apache?

2. Run Certbot to Get the Certificate

Run Certbot and follow the prompts:

 sudo certbot --apache

Certbot will:

How to install a Let's Encrypt SSL certificate on Apache?
  • Ask for your email (used for renewal reminders and security notices)
  • Require agreement to the Let's Encrypt terms of service
  • Prompt you to select domains (from your Apache virtual hosts)

Make sure your domain points to your server and that the Apache site is enabled.


During setup, Certbot may ask if you want to:

  • Redirect HTTP traffic to HTTPS (choose 2 to enable redirect)

This ensures all traffic uses a secure connection.


4. Auto-Renewal Setup

Let's Encrypt certificates expire every 90 days. Certbot sets up a cron job or systemd timer automatically, but you can test renewal with:

 sudo certbot renew --dry-run

If this runs without errors, renewal will work automatically.


5. Verify the Installation

Visit your site using https://yourdomain.com . You should see a secure connection (padlock icon). You can also check using:

 sudo apachectl configtest
sudo systemctl reload apache2

Ensure Apache reloads properly after Certbot modifyes the config.


Troubleshooting Tips

  • Make sure port 80 is open (required for domain validation)
  • Your domain must resolve publicly
  • If Apache fails to reload, check logs: sudo tail -f /var/log/apache2/error.log
  • Certificates are stored in /etc/letsencrypt/live/yourdomain.com/

That's it. Certbot handles certificate generation, Apache configuration, and auto-renewal. Just keep your system updated and monitor logs occasionally.

The above is the detailed content of How to install a Let's Encrypt SSL certificate on Apache?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

ArtGPT

ArtGPT

AI image generator for creative art from text prompts.

Stock Market GPT

Stock Market GPT

AI powered investment research for smarter decisions

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to build a PHP Nginx environment with MacOS to configure the combination of Nginx and PHP services How to build a PHP Nginx environment with MacOS to configure the combination of Nginx and PHP services Jul 25, 2025 pm 08:24 PM

The core role of Homebrew in the construction of Mac environment is to simplify software installation and management. 1. Homebrew automatically handles dependencies and encapsulates complex compilation and installation processes into simple commands; 2. Provides a unified software package ecosystem to ensure the standardization of software installation location and configuration; 3. Integrates service management functions, and can easily start and stop services through brewservices; 4. Convenient software upgrade and maintenance, and improves system security and functionality.

How to resolve apache cannot load libphp.so into server How to resolve apache cannot load libphp.so into server Aug 08, 2025 am 06:07 AM

First,verifythelibphp.sofileexistsusingfindorlocatecommands;ifmissing,reinstallPHPwithApachesupportviapackagemanager.2.CheckApacheconfigurationfilesforcorrectLoadModuledirectivepathandremoveduplicates.3.EnsureApacheandPHPversionsandarchitecturesmatch

How to configure KeepAlive in Apache? How to configure KeepAlive in Apache? Aug 03, 2025 am 07:06 AM

KeepAliveOn enables persistent connections; 2.MaxKeepAliveRequests100 sets the maximum number of requests per connection; 3.KeepAliveTimeout5 sets the timeout for waiting for subsequent requests, restart Apache after configuration and use curl or browser developer tools to verify whether KeepAlive is effective to optimize server performance.

How to install a Let's Encrypt SSL certificate on Apache? How to install a Let's Encrypt SSL certificate on Apache? Aug 04, 2025 am 09:47 AM

Install Certbot and its Apache plug-in; 2. Run Certbot to obtain the certificate and configure the domain name; 3. Optionally configure automatic redirection from HTTP to HTTPS; 4. Set up automatic renewal and pass dry-run test; 5. Verify the installation and ensure the normal reload configuration of Apache. After the certificate is successfully deployed, renewal will be automatically managed. After the entire process is completed, secure HTTPS access can be achieved.

How to choose the right MPM for Apache? How to choose the right MPM for Apache? Jul 26, 2025 am 03:59 AM

ThebestApacheMPMdependsonyourapplicationstackandtrafficneeds:1.UsePreforkifrelyingonnon-thread-safemoduleslikemod_phpandprioritizingstability.2.UseWorkerformoderatetohightrafficwiththread-safesetupsandbettermemoryefficiency.3.UseEventforhighconcurren

Where is the Apache configuration file? Where is the Apache configuration file? Aug 08, 2025 am 01:20 AM

OnDebian/Ubuntu,themainApacheconfigurationfileis/etc/apache2/apache2.conf,withadditionalconfigurationsin/etc/apache2/sites-available/and/etc/apache2/conf-available/.2.OnRHEL/CentOS/Fedora,itistypically/etc/httpd/conf/httpd.conf,withextrafilesin/etc/h

What is the default Apache port? What is the default Apache port? Aug 14, 2025 pm 01:02 PM

ThedefaultApacheportforHTTPis80.1.Port80isusedforunencryptedHTTPtrafficandisthestandardforwebserversincludingApache.2.WhenaURLisenteredwithoutaspecifiedport,browsersautomaticallyconnecttoport80.3.ForHTTPStraffic,thedefaultportis443,commonlyconfigured

How to set a custom 404 error page in Apache? How to set a custom 404 error page in Apache? Jul 27, 2025 am 02:20 AM

To set up a custom 404 error page, you need to create a page file and configure the path in Apache. 1. Create a custom 404 page, such as saving 404.html to the website root directory; 2. Add ErrorDocument404/404.html to the .htaccess file of the website root directory to ensure that AllowOverride is enabled; 3. If you use VPS or a standalone server, you can add ErrorDocument404/404.html in the virtual host configuration file (such as 000-default.conf) and restart the Apache service; 4. Test whether the custom page takes effect by accessing the non-existent URL. When configuring

See all articles