• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache

{{postValue.id}}

Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache

SSL is a web protocol that is used to send trafic between server and client in a secured manner. It provides secure and encrypted transactions between the browser and websites. This protocol generates a certificate which the end user has to authenticate. In this tutorial, we will cover the installation of SSL to initiate secure session on Ubuntu 18.04.

Prerequisites

Install LAMP(Apache, MariaDB, php)

Installation of OpenSSL
apt-get install openssl

Installation

Create the SSL Certificate as follows

root@linuxhelp1:~# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/ca.key -out /etc/ssl/certs/ca.crt
Generating a 2048 bit RSA private key
...................................................................................................................................................+++
......................+++
writing new private key to '/etc/ssl/private/ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) \[AU\]:IN
State or Province Name (full name) \[Some-State\]:
Locality Name (eg, city) \[\]:
Organization Name (eg, company) \[Internet Widgits Pty Ltd\]:
Organizational Unit Name (eg, section) \[\]:
Common Name (e.g. server FQDN or YOUR name) \[\]:
Email Address \[\]:

Create own HTML directory and site configuration

root@linuxhelp1:~# mkdir /var/www/mine
root@linuxhelp1:~#  vim /var/www/mine/index.php
\[..\]
Welcome to Linuxhelp.com
\[..\]

Change ownership and permission of the as own site follows

root@linuxhelp1:~#  chown -R www-data.www-data /var/www/mine/
root@linuxhelp1:~#  chmod -R 775 /var/www/mine/

Create Virtual Host for accessing the site with SSL certificate as shown below

 root@linuxhelp1:~# vim /etc/apache2/sites-available/mine-ssl.conf
\[..\]
 SSLEngine on
SSLCertificateFile /etc/ssl/certs/ca.crt
SSLCertificateKeyFile /etc/ssl/private/ca.key
servername www.linuxhelp1.com
Documentroot /var/www/mine 
\[..\]

Enable site access

root@linuxhelp1:~# a2ensite mine-ssl.conf
Enabling site mine-ssl.
To activate the new configuration, you need to run:
  systemctl reload apache2

Disable default site access

root@linuxhelp1:~#  a2dissite default-ssl.conf
Site default-ssl disabled.
To activate the new configuration, you need to run:
  systemctl reload apache2

Enable SSL module

root@linuxhelp1:~#  a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache\_shmcb for ssl:
Module socache\_shmcb already enabled
Module ssl already enabled

Restart the apache service to make the changes effect

root@linuxhelp1:~#  systemctl restart apache2

Now you can proceed the further installation and configuration from the browser by navigating to the following URL: https://
browser_url

Untrusted connection page appers. Click 'Advanced'
untrusted-page

Then click add exception.
click_add_exception

Click Confirm security Exception.
security_exception

You will see the Website that we have configured with SSL certificate
ssl_website

With this, the method to install of SSL to initiate secure session on Ubuntu 18.04 comes to an end.

Tags:
caden
Author: 

Comments ( 1 )

nobody
I have a python script that sends some HTML text to my Website with SOCKETS is this the correct way to secure the server where my Script is running??
Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is SSL Certificate?

A

SSL is a web protocol that is used to send traffic between server and client in a secured manner. It provides secure and encrypted transactions between the browser and websites. This protocol generates a certificate which the end user has to authenticate.

Q

What the pre-requirements of SSL?

A

The requirements are,
Install LAMP(Apache, MariaDB, php)

Q

How to Create the SSL Certificate?

A

Run the following command:
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/ca.key -out /etc/ssl/certs/ca.crt

Q

How to Create own HTML directory?

A

Use the following command:
# mkdir /var/www/mine

Q

How can I Enable site access?

A

Run the following command:
# a2ensite mine-ssl.conf

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help David Lopez Guillen ?
Ayuda urgente instale SSL para servidor Opensuse y ahora no funciona tengo servicio web

hola segui este tutorial para tener un certificado ssl y ahora no se ve mi app en la red, espero alguien pueda ayudarme, tengo M9oodle en3.5 en un servidor open suse y ahora no funciona por favor ayuda.

https://www.linuxhelp.com/how-to-create-ssl-certificate-in-opensuse

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.