[Unit] Description=Subscriptions Port 80 to 443 Redirect After=network.target [Service] # Set the domain of your instance here: Environment=DOMAIN=subscriptions.gir.st Type=simple ExecStart=/usr/bin/nc -lkc 'read method path http; printf "HTTP/1.1 308 Moved\r\nLocation: https://${DOMAIN}%%s\r\n\r\n" "$path"' 80 Restart=always # NOTE^: must to escape % in ExecStart, or systemd replaces %s with $SHELL [Install] WantedBy=multi-user.target