简体   繁体   中英

installing an SSL on Azure ubuntu web server

我一直试图在VPS上运行的Ubuntu服务器上安装SSL证书。

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM