Enable SSL on your website in Ubuntu

Enable SSL on your website in Ubuntu post thumbnail image

To enable SSL on your website first you need to install SSL on your server. Install SSL Certificates

  1. 1. First edit ssl file in apache2 directory.
root@Linoide:~# vim /etc/apache2/sites-available/default-ssl.conf

Add these lines:

<VirtualHost>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
Servername linoide.com
Serveralias www.linoide.com
</VirtualHost>

Change your SSL file location on these lines

SSLCertificateFile /etc/letsencrypt/live/linoide.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/linoide.com/privkey.pem

2. Now link default ssl file as shown below and restart apache2 service.

root@Linoide:~# ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/000-default-ssl.conf
root@Linoide:~# systemctl restart apache2.service

3. Run this command to enable ssl

root@Linoide:~# a2enmod ssl

That’s it. You are done with your ssl configuration. Now open your URL with https://

———- ———–

If you want to redirect all http request into https then add this line in to your apache2 configuration file

my case, file name is “etc/apache2/sites-enabled/000-default.conf

Redirect / https://www.linoide.com/

after adding this line, It will looks like this

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
Servername linoide.com
Serveralias www.linoide.com
Redirect / https://www.linoide.com/

Restart the service and you are good to go.

Thank you.

1 thought on “Enable SSL on your website in Ubuntu”

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Linux Interview Questions.Linux Interview Questions.

It is not that easy to predict interview questions. Because it all depends on the company’s requirement and also on the panel’s expertise levels. But there are some common questions that most of the time interviewers ask to know your knowledge on Linux Administration. Here I am sharing some top