Yanir Mor
Yanir Mor

Reputation: 711

Create an SSL certificate for a Shiny server running on CentOS

I can't figure how to create an SSL certificate for a Shiny server that runs on a CentOS machine.

My end goal is to be able to access my app with HTTPS.

So instead of - HTTP://mydomain.com:3838/my-app/
To have something like - HTTPS://mydomain.com:3838/my-app/
Or even better - HTTPS://mydomain/my-app/

I tried my best with numerous tutorials but I'm not an expert in system administration and didn't have a lot of success.
Would really appreciate any help here!

# cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core)

# shiny-server --version
Shiny Server v1.5.7.907

Thanks!

Upvotes: 2

Views: 1075

Answers (1)

My answer in one word: letsencrypt.

Letsencrypt provides an executable that will grant you SSL certificates for all the domains your server handles. For this, it validates your machine by mounting a temporary web server and checks if can reach it with the domain names you provided.

There's more info in the official website. Once you have the certs, simply add them to nginx or Apache or whatever web server you are using.

UPDATE:

To forward http calls to your shiny web server you have to use Apache web server as a proxy, that means, that every call yo yourdomain:80, will be redirected to locahost:3838.

You have to edit your default conf. In ubuntu you can find it in this path: /etc/apache2/sites-enabled/000-default.conf

Then, in the conf file:

<VirtualHost *:80>
    # These lines configures SSL
    SSLEngine on
    SSLCertificateFile /path/to/your/ssl.crt
    SSLCertificateKeyFile /path/to/your/ssl.key

    # These lines configure the proxy
    ProxyPreserveHost On
    ProxyPass / http://0.0.0.0:3838/
    ProxyPassReverse / http://0.0.0.0:3838/

    # This sets the domain name to listen for
    ServerName yourdomain.com
</VirtualHost>

Then, restart apache and you're good to go.

Upvotes: 2

Related Questions