
Mi host virtual SSL es tan simple como eso:
LoadModule ssl_module modules/mod_ssl.so
Listen 443
<VirtualHost *:443>
DocumentRoot "/srv/www/test"
ServerName <my_website_domain>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
</VirtualHost>
Cuando intento reiniciar Apache apache2ctl configtest && systemctl restart apache2
me sale:
La tarea de sintaxis OK
para apache2.service falló porque el proceso de control finalizó con un código de error. Consulte "systemctl status apache2.service" y "journalctl -xe" para obtener más detalles.
Pero cuando apago SSLEngine con SSLEngine off
Apache se inicia normalmente y está bien.
Cuando ejecuto systemctl status apache2
después de comenzar con SSLEngine on
, obtengo:
Syntax OK
● apache2.service - The Apache Webserver
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-08-14 18:06:55 CEST; 1min 9s ago
Process: 22352 ExecStop=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k graceful-stop (code=exited, status=0/SUCCESS)
Process: 19851 ExecReload=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k graceful (code=exited, status=0/SUCCESS)
Process: 22346 ExecStart=/usr/sbin/start_apache2 -DSYSTEMD -DFOREGROUND -k start (code=exited, status=1/FAILURE)
Main PID: 22346 (code=exited, status=1/FAILURE)
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351148 2020] [so:warn] [pid 22352] AH01574: module authn_core_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351163 2020] [so:warn] [pid 22352] AH01574: module authz_core_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351170 2020] [so:warn] [pid 22352] AH01574: module php5_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.351179 2020] [so:warn] [pid 22352] AH01574: module ssl_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.352998 2020] [so:warn] [pid 22352] AH01574: module ssl_module is already loaded, skipping
Aug 14 18:06:55 luu056d start_apache2[22352]: [Fri Aug 14 18:06:55.356261 2020] [core:warn] [pid 22352] AH00117: Ignoring deprecated use of DefaultType in line 143 of /etc/apa.../httpd.conf.
Aug 14 18:06:55 luu056d start_apache2[22352]: httpd (no pid file) not running
Aug 14 18:06:55 luu056d systemd[1]: Failed to start The Apache Webserver.
Aug 14 18:06:55 luu056d systemd[1]: apache2.service: Unit entered failed state.
Aug 14 18:06:55 luu056d systemd[1]: apache2.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.
¿Por qué recibo ese error httpd (no pid file) not running
cuando enciendo SSLEngine
?
Nada bloquea el puerto 443, ya que cuando ejecuto lsof -i :443
el resultado está vacío.
Estoy usando Apache/2.4.23 para Linux/SUSE
Respuesta1
Esto es indicativo de un problema con los certificados, httpd no puede cargarlos y por lo tanto no puede iniciarse correctamente. Generalmente esos errores no aparecen a menos que tenga un alto nivel de registro de errores para SSL. Simplemente configúrelo LogLevel ssl:trace8
para probarlo y retírelo cuando lo haga funcionar.
Asegúrese de que los certificados tengan formato PEM (ASCII), que coincidan entre sí y existan en la ruta que les indique:
openssl x509 -in /etc/ssl/certs/apache-selfsigned.crt -noout -modulus
openssl rsa -in /etc/ssl/private/apache-selfsigned.key -noout -modulus
La salida de ambos comandos debería devolver el mismo resultado; si no, no son correctos.
Respuesta2
Me gustaría agradecer a todas las demás personas que respondieron, pero el problema residía en el archivo ssl-globals.conf
.
Estas dos directivas estaban fallando apache
SSLUseStapling on
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
Acabo de comentarlos y ahora está funcionando. No tengo idea de por qué, pero la ciencia se basa en evidencias.