APPLY SSL TO UBUNTU ON AZURE

In attempt to keep track of my daily task, I installed Redmine on one of my Ubuntu servers hosted in Azure. After the setup was completed, I purchased a domain name and SSL certifiate from GoDaddy. I updated the codeheight.solutions domain name A file in GoDaddy with the public IP address.

After I log into my Azure account, I notice the current DNS configuration has a long azure domain name. This works fine, but my goal is to replace with the custom domain name I purchased from GoDaddy.

I installed PuTTY and WinSCP to assist with file transfer. After I configured PuTTY and WinSCP with my Azure server information/creditals, I am able to execute the commands with PuTTY and handle file transfer with WinSCP.


First, generate a new private key.

sudo openssl genrsa -out /opt/bitnami/apache2/conf/server.key 2048

Next, create a certificate to provide GoDaddy. Enter the information about the domain (company, city, state, etc.)

sudo openssl req -new -key /opt/bitnami/apache2/conf/server.key -out /opt/bitnami/apache2/conf/server.csr

After the server.csr has been created, I download the file using WinSCP to my local drive.


Next, I open server.csr, copy the certificate request, paste in GoDaddy's CSR textbox, and provide the Common Name.


Once I submit the information, GoDaddy will create the new certificate. After about 30 minutes, I will have the option to download the new certificate from GoDaddy.


Select Apache from the Download Certificate Server type dropdown and download codeheight.solutions.zip


Next, unzip the files and rename the .crt file to server.crt, then I upload to the Azure server. The gd_bundle-g2-g1.crt is not used in this current setup.


Restart the server using this command:

sudo /opt/bitnami/ctlscript.sh restart apache

The restart was successful, but the current httpd file defaults to port 80. But, I can test port 443 by manually entering https://codeheight.solutions in the address bar. It works, but I want to force all nonsecure connections to port 443.


The final step is to create a redirect command within the virutal host tag in the bitnami.conf file.

#SSL ADD
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
#SSL ADD END

After the file is saved, all request will be redirected to port 443.

Comments are welcome:

Software Solutions

We want to get involved