GoAdmio

https

Enable or disable the HTTP to HTTPS redirect for one domain, every domain, or every domain with a Let's Encrypt certificate

On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also


Overview

/go/https turns the HTTP to HTTPS redirect on or off. It:

[!WARNING] The command does not check that a valid SSL certificate exists. Enabling the redirect for a domain without a working certificate makes the site show a certificate error. Run checkssl first, or use the live target, which only touches domains that have a certificate.


Quick start

# Redirect HTTP to HTTPS for one domain
/go/https example.com Enable

Syntax

/go/https <domain|all|live> <action>

If you run it as a non-root user, it re-runs itself with sudo.

Target Behavior
<domain> Updates one domain, then rebuilds its Apache and Nginx configuration.
all Updates every domain in the Site table, then rebuilds the whole configuration with conf.
live Updates only domains that have a folder in /etc/letsencrypt/live and a /home/<domain>/www directory.

Arguments

Position Argument Required Values Notes
1 domain Yes A domain, all, or live Pass the full domain, for example example.com.
2 action Yes 1 or Enable to enable Anything else disables. See Action matching.

Action matching

Only two values enable the redirect, and they are case-sensitive.

You pass Result
1 Enabled
Enable Enabled
0, Disable, disable Disabled
enable (lowercase) Disabled
Nothing Disabled
Any other text Disabled

Always use 1/Enable to enable and 0/Disable to disable.


Output

Target What you see
<domain> Redirecting HTTP to HTTPS Enabled for <domain>. or ... Disabled for <domain>.
live The same line for each matching domain.
all No message of its own. Only the output of conf appears.

The message is printed even if the domain doesn't exist in the database. See Troubleshooting.


Examples

# Enable the redirect for one domain
/go/https example.com Enable
# Disable the redirect for one domain
/go/https example.com 0
# Enable for every domain that has a Let's Encrypt certificate (safest bulk option)
/go/https live 1
# Enable for every hosted domain, with or without a certificate
/go/https all Enable
# Turn the redirect off everywhere, for example while fixing certificates
/go/https all 0
# Review recent runs
tail /var/log/go/https.log

Troubleshooting

Symptom Likely cause Fix
Browser shows a certificate error after enabling The domain has no valid SSL certificate. Disable with /go/https <domain> 0, install a certificate with ssl or installssl, then enable again.
Redirect loop (ERR_TOO_MANY_REDIRECTS) A proxy such as Cloudflare connects to the origin over HTTP, so the redirect repeats. Set the proxy's SSL mode to Full or Full (strict), or disable the redirect.
Enabled was printed but nothing changed The domain isn't in the Site table (typo, or an alias). The update matched no rows. Check the spelling and use the primary domain.
enable didn't enable Matching is case-sensitive. Use Enable or 1.
Ran without an action and the redirect turned off A missing action counts as disable. Always pass the second argument.
live skipped a domain It has no /etc/letsencrypt/live/<domain> folder, or no /home/<domain>/www. Install a Let's Encrypt certificate, or use the domain name directly.
all printed nothing useful all only runs conf, which prints its own output. Check the SSLRedirect value in the database, or test with curl -I http://<domain>.

Details

What it does

flowchart TD
    A["/go/https target action"] --> B{"Running as root?"}
    B -- "No" --> C["Re-run with sudo"]
    C --> D
    B -- "Yes" --> D["Append the command to /var/log/go/https.log"]
    D --> E{"Target?"}
    E -- "all" --> F["Set SSLRedirect for every row in Site"]
    F --> G["Rebuild all config with /go/conf"]
    E -- "live" --> H["Loop over /etc/letsencrypt/live/*"]
    H --> I{"/home/domain/www exists?"}
    I -- "No" --> H
    I -- "Yes" --> J["Set SSLRedirect for that domain"]
    J --> K["Run /go/apache and /go/nginx for it"]
    K --> H
    E -- "domain" --> L["Set SSLRedirect for that domain"]
    L --> M["Run /go/apache and /go/nginx for it"]

Steps in order

  1. If not root, re-runs itself through sudo.
  2. Appends a timestamped line with the arguments to /var/log/go/https.log.
  3. Reads the domain (argument 1) and action (argument 2).
  4. Sets SSLRedirect to 1 for 1 or Enable, and to 0 for anything else.
  5. Rebuilds the web server configuration:
    • all: one run of conf
    • live and single domain: apache and nginx for each affected domain

Notes


See also

Command Description
checkssl Check if SSL certificates are installed for all domains
installssl Install Let's Encrypt SSL on GoAdmio
ssl Install an SSL certificate for a domain in GoAdmio
zerossl Install a ZeroSSL certificate via the command line
conf Rebuild the Apache/Nginx configuration in GoAdmio
apache Convert a GoAdmio server from Nginx to Apache
nginx Convert a GoAdmio server from Apache to Nginx
create Create a GoAdmio account from the command line