How to Install Let's Encrypt SSL with LEMP Stack on AlmaLinux 9
Let's Encrypt is a non-profit certificate authority run by Internet Security Research Group that provides X.509 certificates for Transport Layer Security encryption at no charge. In this article, we are going to learn how to install Let's Encrypt SSL on AlmaLinux 8. So, let’s get started.
Checkout the Let's Encrypt SSL Project Here.
Get started with $5 VPS from CrownCloud. Check our latest offers : CrownCloud VPS [ 24x7 In-House Customer Support ]
Pre-requisites :
-
A system with AlmaLinux 9 installed and running.
-
root
access to the system. - LEMP Stack installed and running, for this, you can refer to one of our guides on installing the LEMP Stack (Nginx, MariaDB, and PHP).
Once you're all set, we'll proceed with Let's Encrypt SSL installation and configuration.
Install Let’s Encrypt SSL Certificate
Install EPEL repository by running the following command.
dnf install epel-release
dnf upgrade
Install snapd by running the following command.
dnf install snapd
systemctl enable --now snapd.socket
ln -s /var/lib/snapd/snap /snap
Next, Install Certbot by running the following command.
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
Create the root directory for the site to be installed along with an index page.
mkdir -p /var/www/blog.domainhere.info/public_html
echo "<h1>Welcome to blog.domainhere.info hosted with Nginx</h1>" > /var/www/blog.domainhere.info/public_html/index.html
Replace
blog.domainhere.info
with actual domain name.
Enable Firewall:
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
Configuring Apache vHost
server {
listen 80;
listen [::]:80;
root /var/www/example.com/public_html;
index index.html;
server_name example.com www.example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
location / {
try_files $uri $uri/ =404;
}
}
Install SSL Certificate.
Use the certbot command to issue a Let's Encrypt certificate. Replace expample.com
and admin@example.com
with your domain name and email :
certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email admin@example.com -d example.com
SSL certificates are valid for 90 days. The renewal process is now automated, you do not have to renew this manually.
Restart Nginx
Restart apache to avoid getting error messages.
systemctl restart nginx
Now you have successfully installed Let's Encrypt SSL with LEMP Stack on AlmaLinux 9.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS