Redirect a domain to https with nginx in Direct Admin

Direct Admin, NGINX, Quick Tip

I always forget how to redirect a domain from http -> https when i'm in Direct Admin. It is pretty easy:

|*if SSL_TEMPLATE="0"|
    return 301 https://|DOMAIN|$request_uri;
|*endif|

Login as admin, go to Custom HTTPD Configurations, find your domain and add the code in the textarea. Click save and reload your nginx configuration. Done. 

Michiel Gerritsen
About the author

Michiel Gerritsen

Connect on LinkedIn

Founder of Control Alt Delete, a Magento agency specialised in testing, CI/CD and checkout integrations. Working with Magento since 2015, and board member of Mage-OS.

Missing anything?
What are you missing? X
Thank you for your feedback!