Https redirect with Apache


#1

I have successfully installed Lets Encrypt on my Ubuntu server. Navigating to one of my sites with https however redirects me to my html folder. (/var/www/html/) rather than to one of my domains. (/var/www/domain)

I feel like this may be caused somewhere with htaccess but am not sure. Has anyone experienced a similar situation?


#2

It all depends on how the server is set up. Make sure you have the VirtualHost configured correctly, or have the right DocumentRoot for the configuration entered.


#3

Yeah I have narrowed it down to VirtualHost config files. I just need to figure out how to include the .pem files that letsencrypt creates to the config files and I should be in business.


#4

My configuration is like:

SSLCertificateFile      "/etc/letsencrypt/live/**REDACTED**/cert.pem"
SSLCertificateKeyFile   "/etc/letsencrypt/live/**REDACTED**/privkey.pem"
SSLCertificateChainFile "/etc/letsencrypt/live/**REDACTED**/chain.pem"

#5

@motoko has the main one for each vhost but also make certain you have NameVirtualHost *:443 configured.

In my apache it’s in /etc/apache2/ports.conf

<IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. NameVirtualHost *:443 Listen 443 </IfModule>

With that in each vhost just have it with <VirtualHost *:443> with the appropriate ServerName/ServerAlias entries.