
Estoy seguro de que esta pregunta fue respondida más de cien veces (porque casi las he leído todas), pero no puedo hacer que funcione mi redirección apache2.
Soy un principiante total en todo lo relacionado con Linux y actualmente estoy intentando poner en funcionamiento un sitio web. El sitio ya está disponible en https y tiene un certificado.
mala solicitud en el puerto 80
/etc/apache2/ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
etc/apache2/sitios-disponibles/minombredominio.conf
NameVirtualHost *:80
NameVirtualHost <mydomainname>:443
<VirtualHost *:80>
ServerName <mydomainname>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTPS_HOST}%{REQUEST_URI} [R,L]
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost _default_:443>
ServerName <mydomainname>
DocumentRoot /var/www/html
SSLEngine On
</VirtualHost>
También ya ejecuté sudo a2ensite <mydomainname>.conf
si esto es importante.
Respuesta1
Le faltan algunas directivas importantes en :443 VirtualHost
. No se especifican el archivo del certificado SSL ni la clave privada.
La VirtualHost
directiva debería verse así:
Listen 443
<VirtualHost *:443>
ServerName example.com
SSLEngine on
SSLCertificateFile "/path/to/www.example.com.cert"
SSLCertificateKeyFile "/path/to/www.example.com.key"
</VirtualHost>
Consulta el oficialdocumentación de apachepara más detalles: