I thank you for your patience @spryng. It is working fine.
I would like to write down what I have done/learnt during the past few days about
SSL and multi-tenant sub-domain system----
Installation:
I followed manual installation method and when it came to the final stages I did this-
bench new-site name1.site --admin-password ------------------
bench --site name1.site enable-scheduler
bench --site name1.site install-app erpnext
bench start
sudo bench setup production erpnextuser
sudo supervisorctl stop all
sudo supervisorctl start all
bench config dns_multitenant on
bench setup add-domain --site name1.site name1.mydomain.com
bench setup nginx
bench setup reload-nginx
bench new-site name2.site --admin-password ----------
bench --site name2.site enable-scheduler
bench --site name2.site install-app erpnext
bench setup add-domain --site name2.site name2.mydomain.com
bench setup nginx
bench setup reload-nginx
Now for the SSL-certs
Installed certbot–
sudo apt-get remove certbot
sudo apt install snapd
sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Now two posibilites : each subdomain has its own SSL or to use wildcard–
For each sub-domain having its own cert----
sudo certbot --nginx ( select required site from list) ( repeat for each site )
I think one can also do – (???)
sudo certbot --nginx -d site1 -d site2 …etc
For wildcard certbot SSL ------
sudo certbot certonly --manual
Answer a few questions. Certbot gives a “TXT” record that must be entered on your
domain DNS records.
To check when the TXT record has propogated prpoperky use-
dig -t txt _acme-challenge.mydomain.com
sudo certbot certificates ( to show certs)
After completion the location of the certs are given and I then edited my
common_site_config.json file ( /erpnext/config ) to add the “wildcard” section
It now looks like this–
{
“auto_update”: false,
“background_workers”: 1,
“dns_multitenant”: true,
“file_watcher_port”: 6787,
“frappe_user”: “frappe-user”,
“gunicorn_workers”: 2,
“rebase_on_pull”: false,
“redis_cache”: “redis://localhost:13000”,
“redis_queue”: “redis://localhost:11000”,
“redis_socketio”: “redis://localhost:12000”,
“restart_supervisor_on_update”: true,
“restart_systemd_on_update”: false,
“serve_default_site”: true,
“shallow_clone”: true,
“socketio_port”: 9000,
“webserver_port”: 8000,
“wildcard”: {
“domain”: “*.mydomain.com”,
“ssl_certificate”: “/etc/letsencrypt/live/mydomain.com/fullchain.pem”,
“ssl_certificate_key”: “/etc/letsencrypt/live/mydomain.com/privkey.pem”
}
}
then –
bench setup nginx
sudo service nginx reload
clear cache on browser