Skip to content

Instantly share code, notes, and snippets.

@rajeevkannav
Forked from mgrouchy/gist:524908
Last active February 22, 2018 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rajeevkannav/6a479736552df68d4a431e334ad1951b to your computer and use it in GitHub Desktop.
Save rajeevkannav/6a479736552df68d4a431e334ad1951b to your computer and use it in GitHub Desktop.
#first generate a key for your domain
openssl genrsa -out yourdomain.com.key 2048
#then generate the request
openssl req -new -key yourdomain.com.key -out yourdomain.com.csr
#if you want to remove the password from your certificate so its
#not required on webserver restart(optional)
mv yourdomain.com.key yourdomain.com.passkey
sudo openssl rsa -in yourdomain.com.passkey -out yourdomain.com.key
#if on nginx prepare your certificate by combining the Four files given to
#you by NameCheap *yourdomainname*.crt ComodoRSADomainValidationSecureServerCA.crt
# COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt
#BE CAREFULL AB
cat *yourdomainname*.crt ComodoRSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt >> yourdomain.com_combined.crt
#if on nginx prepare your certificate by combining the two files given to
#you by godaddy
cat yourdomain.com.crt gd_bundle.crt > yourdomain.com_combined.crt
#your nginx config for your server on port 443 will contain
ssl on;
ssl_certificate /ssl_location/yourdomain.com_combined.crt;
ssl_certificate_key /ssl_location/yourdomain.com.key;
#if you are on apache your apache config should look like this
#unlike nginx apache allows you to specify a Certificate chain
#file so you don't have to combine your certificates to make them
#appear correctly in all browsers.
SSLEngine On
SSLCertificateFile /ssl_location/yourdomain.com.crt
SSLCertificateKeyFile /ssl_location/yourdomain.com.key
SSLCertificateChainFile /ssl_location/gd_bundle.crt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment