here is how to configure your local environment to browse over trusted ssl over https, in this guide i am using ubuntu 20 with apache2 but it can run at any os or app server
1- in order to install a cert, we will need to install "certutil":
sudo apt install libnss3-tools
2- download the latest mkcert:
curl -s https://api.github.com/repos/FiloSottile/mkcert/releases/latest| grep browser_download_url | grep linux-amd64 | cut -d '"' -f 4 | wget -qi -
mv mkcert-v*-linux-amd64 mkcert
chmod a+x mkcert
sudo mv mkcert /usr/local/bin/
3- install mkcert
mkcert -install
4- create your localhost certificates:
mkcert local-domain.com '*.local-domain.com' localhost 127.0.0.1 ::1
5- apache | enable ssl:
sudo a2enmod ssl
6- apache | create a ssl site config:
cd /etc/apache2/sites-available/
sudo cp default-ssl.conf your-local-domain.conf
sudo nano your-local-domain.conf
edit the file and add your ssl file and key to the lines below:
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
7- apache | firewall | allow https port
sudo ufw enable
sudo ufw allow 'Apache Full'
8- apache | enable the new site and restart apache2:
sudo a2enmod ssl
sudo a2enmod headers
sudo a2ensite your-local-domain.conf
sudo systemctl restart apache2
sources:
https://bit.ly/3lyvyhr
https://bit.ly/3DHeJaa
https://do.co/3lAZAkO
Comments
Post a Comment