Skip to content

Instantly share code, notes, and snippets.

@luisfc
Created December 11, 2018 23:19
Show Gist options
  • Save luisfc/71cb2a38a6949bede4f992be6a3774fc to your computer and use it in GitHub Desktop.
Save luisfc/71cb2a38a6949bede4f992be6a3774fc to your computer and use it in GitHub Desktop.
#Nginx.conf file
server {
listen 80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name site.local;
ssl_certificate /etc/ssl/certs/site.local.crt;
ssl_certificate_key /etc/ssl/private/site.local.key;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
root /var/www/html;
index index.php index.html;
}
###############
#Install openssl
sudo apt-get install libssl-dev openssl
#Generate a Self-Signed Certificate using OpenSSL
#Create the Certificate using OpenSSL
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/site-local.key -out /etc/ssl/certs/site-local.crt
#Optional argument if create the Certificate Configuration File ==> -config site.local.conf
#Reload the Nginx configuration changes
sudo service nginx reload
#Open up the Google Chrome to Verify that Nginx Loads the Site Over HTTP and HTTPS
#Configure Chrome to Trust the Certificate and to Show the Site as Secure
#Add the certificate to the trusted CA root store
#Install certutil
apt-get update
apt-get install libnss3-tools
certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n "site.local" -i site.local.crt
#Close all the Google Chrome windows and reopen. Chrome is now showing the site as secure.
#See a list of all your certificates and their names:
certutil -d sql$HOME/.pki/nssdb -L
#If you need to delete a certificate
certutil -D -d sql:$HOME/.pki/nssdb -n site.local.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment