Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sgoericke/7ce663d80a553c40a3ad4d8ca491d2aa to your computer and use it in GitHub Desktop.

Select an option

Save sgoericke/7ce663d80a553c40a3ad4d8ca491d2aa to your computer and use it in GitHub Desktop.

Revisions

  1. @yuezhu yuezhu created this gist Feb 7, 2018.
    16 changes: 16 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Generate a unique private key (KEY)
    sudo openssl genrsa -out mydomain.key 2048

    # Generating a Certificate Signing Request (CSR)
    sudo openssl req -new -key mydomain.key -out mydomain.csr

    # Creating a Self-Signed Certificate (CRT)
    openssl x509 -req -days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt

    # Append KEY and CRT to mydomain.pem
    sudo bash -c 'cat mydomain.key mydomain.crt >> /etc/ssl/private/mydomain.pem'

    # Specify PEM in haproxy config
    sudo vim /etc/haproxy/haproxy.cfg
    listen haproxy
    bind 0.0.0.0:443 ssl crt /etc/ssl/private/mydomain.pem