ServerPilot’s free plan doesn’t let you enable SSL on your apps using their web-based interface but if you need to install SSL certs on your apps in a ServerPilot free server, then I’ve brought you a useful Python package (available via PIP) that will automate the SSL installation for you.
Sign into your server as root using an SSH client and then install the package using PIP. If PIP isn’t installed on your system, first install it:
apt install python-pip
And then install
pip install rwssl
Once installed, you will have a new command
rwssl available in your SSH client.
rwssl -h and you will get help on commands available to install, uninstall and renew SSL certificates.
usage: rwssl [-h] [-a] [-f] [-i IGNOREAPPS] [-n APPNAME] [-r] [-ic] [-dc] [-ap] [-na] [-re] [-redir REDIRECT] [-noredir NOREDIRECT] A Python script that automates the SSL installation on Ubuntu servers managed by ServerPilot.io. optional arguments: -h, --help show this help message and exit -a, --all Install SSL for all available apps. -f, --fresh Obtain and install SSL certificates for new (non-ssl) apps only. -i IGNOREAPPS, --ignore IGNOREAPPS Comma-seperated app names to ignore some apps and install SSL for all others. -n APPNAME, --name APPNAME Name of the app where SSL should be installed. -r, --renew Renew all installed SSL certificates which are about to expire. -ic, --installcron Install the cron job for SSL renewals. -dc, --deletecron Uninstall the cron job responsible for SSL renewals. -ap, --autopilot A CRON job that attempts to automatically obtain SSL certificates for newly added apps. -na, --noautopilot Disable Autopilot mode and disable automatic SSLs for your apps. -re, --refresh Cleans all previous SSL vhost files, reinstalls the SSLs and reloads nginx. Only needed if you are having issues on a server with old SSL installations. -redir REDIRECT, --redirect REDIRECT Apply a 301 redirect from HTTP to HTTPs for a given app or for all apps. -noredir NOREDIRECT, --noredirect NOREDIRECT Disable HTTP to HTTPs redirect for a single app or for all apps.
For example to install SSL certificate on all available apps, you will need to run
rwssl -a or
rwssl --all. Both commands will perform the same action.
If you are using my old script, then you need to first delete it and then follow the Getting Started section in this guide:
rm /usr/local/bin/rwssl && pip install rwssl
Upgrading to a newer version is super-easy:
pip install --upgrade rwssl
rwssl, simply do:
pip uninstall rwssl
And then delete the added CRON jobs:
# Delete SSL renewal cron rm /etc/cron.d/rwsslrenew # Also delete auto-pilot cron rm /etc/cron.d/rwssl