• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

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

4402

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

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

Related Tutorials in Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache

Related Tutorials in Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache

How to install Meld tool in Ubuntu
How to install Meld tool in Ubuntu
Feb 25, 2017
How to install Dconf-Editor on Ubuntu 18.04
How to install Dconf-Editor on Ubuntu 18.04
Jul 14, 2018
How to install and update OpenSSL on Ubuntu 16.04
How to install and update OpenSSL on Ubuntu 16.04
Mar 9, 2017
How to install GLib 2.0 on Ubuntu 17.04
How to install GLib 2.0 on Ubuntu 17.04
May 22, 2017
How to Install Android Emulator on Ubuntu 20.4.1
How to Install Android Emulator on Ubuntu 20.4.1
Jul 13, 2021
How To Install AnyDesk on Ubuntu 16.04
How To Install AnyDesk on Ubuntu 16.04
Apr 4, 2018
How to install Genymotion 2.12.1 on Ubuntu 18.04
How to install Genymotion 2.12.1 on Ubuntu 18.04
Jul 9, 2018
How to install WinRAR 5.11 on Linuxmint 18.03
How to install WinRAR 5.11 on Linuxmint 18.03
May 22, 2018

Related Forums in Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache

Related Forums in Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache

Ubuntu
matthew class=
Failed to enable unit: Refusing to operate on linked unit file sshd.service
Apr 15, 2019
Ubuntu
mason class=
Passwd: You may not view or modify password information for root On Ubuntu 19.04
May 27, 2019
Ubuntu
isaac class=
/etc/apt/sources.list Permission denied
May 18, 2017
Ubuntu
yousuf class=
lsb_release command not working : Debian
Jan 18, 2018
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Ubuntu
mason class=
"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1
Mar 15, 2021
NFS
luke class=
clnt_create: RPC: Program not registered
Apr 25, 2017
Apache
isaac class=
How to disable apache welcome page on Ubuntu
Dec 15, 2018

Related News in Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache

Related News in Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache

How To Install Mixxx on Ubuntu 16.04
How To Install Mixxx on Ubuntu 16.04
Oct 11, 2017
Ubuntu 17.04 released with greater expectations
Ubuntu 17.04 released with greater expectations
Apr 15, 2017
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Mar 1, 2017
A Newer and a Faster Window Manager for Tina (Linux Mint 19.2)
A Newer and a Faster Window Manager for Tina (Linux Mint 19.2)
Apr 9, 2019
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Sep 2, 2017
Linux Mint 18.2 Ubuntu based Operating System is named Sonya
Linux Mint 18.2 Ubuntu based Operating System is named Sonya
May 2, 2017
Ubuntu Unity is no more: One Linux dream has been axed
Ubuntu Unity is no more: One Linux dream has been axed
Apr 7, 2017
Refreshed Linux Mint Debian Edition (LMDE) 2 'Betsy' ISO images now available
Refreshed Linux Mint Debian Edition (LMDE) 2 'Betsy' ISO images now available
Mar 14, 2017
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 Sebastian ?
How to change non required to required field in SuiteCRM Custom/Default Modules

How to change not required to the required field in SuiteCRM Custom/Default Modules?

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.