Asuquo12
Asuquo12

Reputation: 835

installing an SSL on Azure ubuntu web server

I have been trying to install an SSL Certificate on an Ubuntu Server running on a VPS.

Upvotes: 2

Views: 3647

Answers (3)

Joel Wembo
Joel Wembo

Reputation: 870

∘ Step 1: Connect to VM ∘ Step 2: Install OpenSSL and Apache2 ∘ Step 3: Create a Directory for the SSL Certificate ∘ Step 4: Generate the SSL Certificate and Key ∘ Step 5: Configure Apache to Use the SSL Certificate ∘ Step 6: Enable the SSL Module and Your Site ∘ Step 7: Restart Apache

You can get more details here SSL Certificate in ubuntu machine

Upvotes: 0

Asuquo12
Asuquo12

Reputation: 835

He is what I did to resolve the issue. 1. I created a new endpoint (HTTPS - port 443) from my Microsoft Azure portal

On my Ubuntu VM terminal, I did the following. To enable the SSL module in Apache2 you issue the command below

sudo a2enmod ssl

The you need to enable the site that would using the SSL

sudo a2ensite default-ssl

The directories /etc/ssl/certs and /etc/ssl/private are the default locations. If you install the certificate and key in another directory make sure to change SSLCertificateFile and SSLCertificateKeyFile appropriately. Add the following to your default-ssl file.

    SSLEngine on
    SSLCertificateKeyFile /etc/sslmate/example.com.key
    SSLCertificateFile /etc/sslmate/example.com.crt
    SSLCertificateChainFile /etc/sslmate/example.comchain.crt


SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
SSLHonorCipherOrder on
SSLCompression off

now configured for HTTPS, restart the apache2 service to enable the new settings:

sudo service apache2 restart

You might want to redirect all your HTTP request to HTTPS, add the code below to your virtualHost file listening to port 80. It will redirect all HTTP request to the HTTPS (https://example.com)

<VirtualHost _default_:80>
 RewriteEngine On
     RewriteRule /.* https://example.com/ [R]

</VirtualHost>

Upvotes: 4

Bruno Faria
Bruno Faria

Reputation: 5262

1) Generate the private key using openssl (install it if you don't have)

openssl genrsa -des3 2048 > privatekey.key

2) Generate the Certificate Signing Request (.CSR)

openssl req -new -key privatekey.key > mycsr.csr

3) Send the .csr to the certificate company (for example, certsign, godaddy, etc.)

4) You will receive the .CRT file from this company. Copy to your linux machine and setup your web server. On apache vhosts config:

SSLCertificateKeyFile /etc/local/ssl/privatekey.key // Generated Private Key
SSLCertificateFile /etc/local/ssl/receivedfile.crt // Received CRT
SSLCACertificateFile /etc/local/ssl/intermediate.crt // Certificate company sends this to you as well

5) Restart the web server

Upvotes: 2

Related Questions