DEV Community

Radhakishan Jangid
Radhakishan Jangid

Posted on

1

Add free ssl on apache2 server ubuntu

नमस्ते 🙏

Free free free 🤩 🥳

Run following command to install free certificate on apache2 server.

Run this command to update existing packages.

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Run this command to install certbot, which provides free certificate for 1 year.

sudo apt install certbot python3-certbot-apache
Enter fullscreen mode Exit fullscreen mode

After successfully installation run this command to get free ssl

sudo certbot --apache
Enter fullscreen mode Exit fullscreen mode

After, enter an email address to get notification when your ssl is about to expire.

article-1

Agree to their terms and condition.

Enter your domain where you wants to install ssl.

article-2

Congratulations! You have successfully installed free certificate on your domain.

Verifying Certbot Auto-Renewal

To auto renewal run following commands:

sudo systemctl status certbot.timer
Enter fullscreen mode Exit fullscreen mode

Your output will be similar to the following:

Output
● certbot.timer - Run certbot twice daily
     Loaded: loaded (/lib/systemd/system/certbot.timer; enabled; vendor preset:>
     Active: active (waiting) since Mon 2022-04-11 20:52:46 UTC; 4min 3s ago
    Trigger: Tue 2022-04-12 00:56:55 UTC; 4h 0min left
   Triggers: ● certbot.service

Apr 11 20:52:46 jammy-encrypt systemd[1]: Started Run certbot twice daily.
Enter fullscreen mode Exit fullscreen mode

To test the renewal process, you can do a dry run with certbot:

sudo certbot renew --dry-run
Enter fullscreen mode Exit fullscreen mode
Output
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/your_domain.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Account registered.
Simulating renewal of an existing certificate for your_domain and www.your_domain.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded:
  /etc/letsencrypt/live/your_domain/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Enter fullscreen mode Exit fullscreen mode

If you don’t receive any errors, you’re all set. When necessary, Certbot will renew your certificates and reload Apache to pick up the changes. If the automated renewal process ever fails, Let’s Encrypt will send a message to the email you specified, warning you when your certificate is about to expire.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (1)

Collapse
 
olsard profile image
olsard

Thanks a lot for sharing. Useful.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay