ssl certificate django and apache code example

Example: installing ssl certificate on apache server for django project

sudo apt-get update

sudo apt-get install software-properties-common

sudo add-apt-repository universe

sudo add-apt-repository ppa:certbot/certbot

sudo apt-get update

sudo apt-get install certbot python-certbot-apache

note:yourfilename.conf should be your apache config file 
  
sudo nano /etc/apache2/sites-available/yourfilename.conf

note: add the domain  name in your apache .conf file 
note: comment out the 3wsgi commands in .conf file 

servername www.example.com

note:save it and run the following commands

cd

sudo certbot --apache

note:your are in install process so complet it

note:and the certificates are installed and now make the following changes

sudo nano /etc/apache2/sites-available/yourfilename.conf

note:remove all django commands from the files u created except the ones created by cbot

sudo nano /etc/apache2/sites-available/yourfilename-le-ssl.conf

note:uncomment the 3 wsgi commands from the nw file

sudo ufw allow ufw https

sudo service apache2 restart

your done