SSL Setup on Amazon Linux 2023 with Apache

You are currently viewing SSL Setup on Amazon Linux 2023 with Apache

In today’s world, security is one of the most important aspects when it comes to hosting a website. One of the key components of website security is SSL or Secure Socket Layer. SSL is a protocol that encrypts data transmitted between a web server and a web browser, ensuring that sensitive information such as credit card numbers, login credentials, and personal information remains safe from prying eyes. In this blog, we will discuss how to set up SSL on Amazon Linux 2023.


Before we get started, it’s important to note what you will need to have and understand for this SSL setup process to be a success. The prerequisites include:

A fully functional Amazon Linux 2023 server instance with root or sudo privileges.
A registered domain name and access to your DNS records. We’ll be using this to associate with your server’s public IP address.
Working knowledge of Linux terminal commands.
Familiarity with Apache server management, as we’ll be installing and configuring it for use with SSL.
Basic understanding of SSL certificates and how they work to secure data transmission.

Setting Up the Amazon Linux Environment

Before we install Apache and configure SSL, we need to make sure our Amazon Linux 2023 environment is ready. Here’s how we do it:

sudo dnf update -y

Install Apache and mod_ssl

The first step is to install Apache and mod_ssl. Apache is the most popular web server in the world, and mod_ssl is an Apache module that provides support for SSL encryption.

To install Apache and mod_ssl on Amazon Linux 2023, you can use the following command:

sudo dnf install httpd mod_ssl
sudo systemctl start httpd

sudo systemctl enable httpd

Verify Apache Installation: You can verify if Apache is running by typing

sudo systemctl status httpd

Or simply by putting your server’s IP address into a web browser. You should see the Apache test page.

In the next sections, we will cover how to obtain an SSL Certificate and how to configure Apache to use SSL. Stay tuned.

Obtaining the SSL Certificate

In order to secure our website, we need an SSL certificate. In this guide, we will use Let’s Encrypt, which provides free SSL certificates.

Install Certbot: Certbot is a tool provided by Let’s Encrypt to easily obtain SSL certificates. Install it with:

sudo dnf install python3 augeas-libs

sudo python3 -m venv /opt/certbot/
sudo /opt/certbot/bin/pip install --upgrade pip

sudo /opt/certbot/bin/pip install certbot certbot-apache
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot

Obtain the SSL Certificate: Run Certbot and follow the interactive prompts to obtain your certificate:

sudo certbot --apache

Remember to enter your email and agree to the terms and conditions. When asked to choose between enabling both HTTP and HTTPS access or forcing HTTPS, select the second option for better security.

Testing the SSL Setup

To ensure everything is working properly, we should test our SSL setup.

  1. Browser Test: The simplest way to test your setup is to visit your site at ‘‘. Replace ‘’ with your actual domain name. Your browser should show a padlock icon in the address bar, indicating a secure connection.
  2. SSL Server Test: For a more thorough test, you can use an online SSL server testing tool, such as the one provided by Qualys SSL Labs.


In case of issues, here are some common problems and their solutions:

  • Apache doesn’t start: Check the Apache error log /var/log/httpd/error_log for any error messages. They should give you a hint about what’s going wrong.
  • SSL certificate errors: Ensure your SSL certificates are correctly installed and the paths in your Apache configuration file are correct.
  • The browser shows “Your connection is not private”: This can be due to an incorrectly installed certificate, the certificate not matching the domain name, or your system date and time being incorrect. Verify these settings to resolve the issue.

In the next sections, we will cover additional security measures and conclude this guide.

Additional Tips for Secure Configurations

To further enhance the security of your Apache server and SSL implementation, consider the following tips:

  1. Secure Cipher Suites: Update your Apache configuration to use only secure cipher suites. This prevents the use of outdated or vulnerable encryption methods.
  2. HTTP Strict Transport Security (HSTS): Enable HSTS to ensure browsers always use a secure connection to your site. This can help prevent man-in-the-middle attacks.
  3. Regular Updates: Regularly update your system and installed packages to get the latest security patches.
  4. Monitoring: Monitor your server logs for any suspicious activity. Automated tools can help with this.
  5. Firewall Configuration: Ensure your firewall is properly configured to allow only necessary traffic.
  6. Backup: Regularly back up your system and configuration files to quickly recover in case of any issues.


In this guide, we have walked through the process of setting up SSL on an Apache server running on Amazon Linux 2023. We have covered everything from preparing your system and installing Apache to obtaining an SSL certificate and configuring Apache to use it. We have also discussed how to test your SSL setup and provided troubleshooting tips in case of issues. Finally, we covered additional security measures for a secure configuration.

SSL is an important part of securing your website and protecting your users’ data. Although the setup process can seem complex, the security benefits are well worth it. With this guide, you should be well-equipped to set up SSL on your own Apache server.


For more detailed information and further exploration, consider the following resources:

  1. Apache Documentation
  2. Let’s Encrypt Documentation
  3. Amazon Linux Documentation
  4. Qualys SSL Labs
  5. Mozilla SSL Configuration Generator

Atiqur Rahman

I am MD. Atiqur Rahman graduated from BUET and is an AWS-certified solutions architect. I have successfully achieved 6 certifications from AWS including Cloud Practitioner, Solutions Architect, SysOps Administrator, and Developer Associate. I have more than 8 years of working experience as a DevOps engineer designing complex SAAS applications.

This Post Has 2 Comments

  1. Arshad

    Thanks brother for helping us.

    I need code for auto renewal SSL certificate Cron job for above Amazon Linux 2023 with Apache

    1. barani

      Yes Bro

Leave a Reply