Question

I cannot redirect the subdomain to SSL

Posted January 23, 2020 79 views
DigitalOcean Accounts

I cannot redirect the subdomain to SSL. My domain is izybai.com, it’s good. But when I write the subdomain manager.izybai.com it does not redirect me to SSL, that is, as if I did not have an SSL certificate.

Virtual host archive:

VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName izybai.com
    ServerAlias www.izybai.com
    DocumentRoot /var/www/izybai.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName gestor.izybai.com
    ServerAlias www.gestor.izybai.com
    DocumentRoot /var/www/izybai.com/backend
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Please help me!

Thansk!

edited by bobbyiliev

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello,

What I could suggest here is to use certbot to issue a new SSL certificate for your subdomain and then also let certbot add the redirect to HTTPS automatically for you.

If you have certbot already installed, then you can do that with the following command:

sudo certbot --apache -d gestor.izybai.com -d www.gestor.izybai.com

You should see the following output in the end:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

If you choose option number 2, then certbot will add the redirect for you.

For more information you can take a look at this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-18-04

Hope that this helps!
Regards,
Bobby

by Kathleen Juell
by Erika Heidi
Let's Encrypt is a Certificate Authority (CA) that provides an easy way to obtain and install free TLS/SSL certificates, thereby enabling encrypted HTTPS on web servers. In this tutorial, you will use Certbot to obtain a free SSL certificate for Apache on Ubuntu 18.04 and set up your certificate to renew automatically.
Submit an Answer