Install SSL on Apache Web Server
A technical guide for installing your SSL certificate on an Apache web server. This involves uploading the files and editing the virtual host configuration.
Prerequisites
You need shell access (e.g., via SSH) to your server and root or sudo privileges. Make sure you have the certificate.crt
, private.key
, and ca_bundle.crt
files ready.
Step-by-Step Installation
-
Upload Certificate Files to Your Server
Copy your three certificate files to a directory on your server. A common practice is to create a directory inside/etc/ssl/
. For example:/etc/ssl/your_domain/
. -
Enable the Apache SSL Module
The Apache SSL module,mod_ssl
, must be enabled. You can do this with the command (on Debian/Ubuntu):sudo a2enmod ssl
-
Configure the Virtual Host File
Locate your domain's virtual host configuration file. This is typically in/etc/apache2/sites-available/
. You need to edit the virtual host block for port 443. If it doesn't exist, you can copy your existing port 80 block and modify it. -
Add SSL Directives
Inside your<VirtualHost *:443>
block, add the following lines, updating the file paths to match where you uploaded your files:SSLEngine on SSLCertificateFile /etc/ssl/your_domain/certificate.crt SSLCertificateKeyFile /etc/ssl/your_domain/private.key SSLCertificateChainFile /etc/ssl/your_domain/ca_bundle.crt
-
Test Your Configuration
It's crucial to test your Apache configuration for syntax errors before restarting.
If it returns "Syntax OK", you are ready to proceed.sudo apache2ctl configtest
-
Restart Apache
Apply the changes by restarting the Apache service.sudo systemctl restart apache2
Verify the Installation
After Apache restarts, check that your website is loading correctly over HTTPS. Use our free SSL Certificate Checker to get a full report on your new SSL setup.
Success! Your Apache server is now configured for SSL, and your site is secure.