Introduction:
SSL (Secure Sockets Layer) certificates are essential for securing communication between a web server and a browser. They encrypt data transmitted over the internet, ensuring confidentiality and integrity. In this guide, we’ll walk you through the process of installing SSL certificates on Ubuntu, enabling secure connections to your web server.
Prerequisites:
Before proceeding, ensure you have:
- A domain name pointing to your server’s IP address.
- SSH access to your Ubuntu server with sudo privileges.
Step 1: Set Hostname:
set hostname particular server or ip
hostnamectl set-hostname your_domain.com
add hostname and ip hosts files
nano /etc/hosts
127.0.0.1 localhost
your_ip your_domain.com
# The following lines are desirable for IPv6 capable hosts
Step 2: Install Certbot:
Certbot is a tool for automating the deployment of SSL certificates. Install Certbot and the Nginx plugin (if you’re using Nginx) using the following commands:
sudo apt install certbot python3-certbot-apache -y
Step 3: Edit the Apache.config file:
sudo nano /etc/apache2/sites-available/your_domain.conf
run above command it will open config file and add below lines of code.
…
ServerName your_domain;
SeverAlias www.your_domain
…
and finally save and exit
Step4: Apache Config test and Reload:
run the following commad:
sudo apache2ctl configtest
sudo systemctl reload apache2
sudo ufw status
sudo ufw allow 'Apache Full'
sudo ufw status
Step5: Certbot – Apache
run the following command cetbot apache
sudo certbot --apache
and give the instuctions
Enter email address (used for urgent renewal and security notices) (Enter ‘c’ to
cancel):[email protected]
(A)gree/(C)ancel:A
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let’s Encrypt project and the non-profit
organization that develops Certbot? We’d like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
(Y)es/(N)o:Y
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated) (Enter ‘c’ to cancel):example.com
1: No redirect – Make no further changes to the webserver configuration.
2: Redirect – Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you’re confident your site works on HTTPS. You can undo this
change by editing your web server’s configuration.
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel):2
IMPORTANT NOTES:
– Congratulations! Your certificate and chain have been saved at:
Step 6: Access SSL:
You can now access ssl your_domain.com,Open your web browser and navigate to https://your-domain.com
Conclusion:
Setting up SSl on Ubuntu 20.04 is a straightforward process that can be accomplished in just a few steps. By following this guide, running in no time, ready to handle your email delivery needs with ease and efficiency. If you encounter any issues, as on contact [email protected]