How to get free SSL certificate - stonezhong/DataManager GitHub Wiki

The site will need you to put a url with known content to prove you own the site. You can do the following:

Update urls.py, add the following lines:

from django.conf.urls import url, include
from django.urls import path
from django.contrib import admin
from django.shortcuts import redirect

from explorer import views

urlpatterns = [
    path('', lambda req: redirect('/explorer/datasets')),  # hack, avoid extra redirect
    path('admin/', admin.site.urls),
    url(r'^api/', include('main.urls')),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    url(r'^explorer/', include('explorer.urls')),
    path('.well-known/acme-challenge/mlhSihbAVhD1xOT4H8RsFj5cVLepXtkG3Xc82plLLZQ', views.letsencrypt, name='letsencrypt'),
]

so the last line with name='letsencrypt' will create a top level URL

Update the view file: server/explorer/views.py

def letsencrypt(request):
    return HttpResponse("mlhSihbAVhD1xOT4H8RsFj5cVLepXtkG3Xc82plLLZQ.sywOEQ5dSXlmO1xrkMppiEh2IRAjylAg7cjNfrLejj0")

copy the certs from dhmost to reverse proxy

scp dmhost:/etc/letsencrypt/live/demo.dmbricks.com/privkey.pem    demo_server.key
scp dmhost:/etc/letsencrypt/live/demo.dmbricks.com/fullchain.pem  demo_server.crt
scp demo_server.key gw:/etc/ssl/certs/demo_server.key
scp demo_server.crt gw:/etc/ssl/certs/demo_server.crt