-
-
Save UbuntuEvangelist/43d802000c0f0cdf84de18338d03629d to your computer and use it in GitHub Desktop.
Installing OpenSSL on Ubuntu 18.04 LTS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo apt-get update && sudo apt-get upgrade | |
openssl version -a | |
#Install the necessary packages for compiling | |
sudo apt install build-essential checkinstall zlib1g-dev -y | |
#Download OpenSSL | |
cd /usr/local/src/ | |
sudo wget https://www.openssl.org/source/openssl-1.1.1c.tar.gz | |
sudo tar -xf openssl-1.1.1c.tar.gz | |
cd openssl-1.1.1c | |
#Install OpenSSL | |
sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib | |
sudo make | |
sudo make test | |
sudo make install | |
#Configure OpenSSL Shared Libraries | |
cd /etc/ld.so.conf.d/ | |
sudo nano openssl-1.1.1c.conf | |
/usr/local/ssl/lib | |
#Save and exit | |
sudo ldconfig -v | |
#Configure OpenSSL Binary | |
sudo mv /usr/bin/c_rehash /usr/bin/c_rehash.backup | |
sudo mv /usr/bin/openssl /usr/bin/openssl.backup | |
sudo nano /etc/environment | |
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/ssl/bin" | |
#Ensure to save before you exit | |
source /etc/environment | |
echo $PATH | |
#We can now check and verify our installation | |
which openssl | |
openssl version -a | |
#Use OpenSSl for Self-Signed SSL Certificate | |
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/my.key -out /etc/ssl/certs/my.crt | |
#Configure Nginx for SSL | |
server { | |
listen 443; | |
ssl on; | |
ssl_certificate /etc/ssl/your_domain_name.pem; (or bundle.crt) | |
ssl_certificate_key /etc/ssl/your_domain_name.key; | |
server_name your.domain.com; | |
access_log /var/log/nginx/nginx.vhost.access.log; | |
error_log /var/log/nginx/nginx.vhost.error.log; | |
location / { | |
root /home/www/public_html/your.domain.com/public/; | |
index index.html; | |
} | |
} | |
sudo /etc/init.d/nginx restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment