1

When I am trying to run Apache2 reload, I am getting the following error. What am I doing wrong?

/etc/apache2# journalctl -xn
-- Logs begin at So 2016-08-07 18:21:40 CEST, end at Do 2016-08-18 12:33:31 CEST. --
Aug 18 12:28:58 nma apache2[23097]: Reloading web server: apache2 failed!
Aug 18 12:28:58 nma apache2[23097]: Apache2 is not running ... (warning).
Aug 18 12:28:58 nma systemd[1]: apache2.service: control process exited, code=exited status=1
Aug 18 12:28:58 nma systemd[1]: Reload failed for LSB: Apache2 web server.
-- Subject: Unit apache2.service has finished reloading its configuration
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit apache2.service has finished reloading its configuration
-- 
-- The result is failed.
Aug 18 12:30:10 nma postfix/smtpd[23117]: connect from unknown[IPADDRESS]
Aug 18 12:30:11 nma postfix/smtpd[23117]: lost connection after AUTH from unknown[IPADDRESS]
Aug 18 12:30:11 nma postfix/smtpd[23117]: disconnect from unknown[IPADDRESS]
Aug 18 12:33:31 nma postfix/anvil[23119]: statistics: max connection rate 1/60s for (smtp:IPADDRESS) at Aug 18 12:30:10
Aug 18 12:33:31 nma postfix/anvil[23119]: statistics: max connection count 1 for (smtp:IPADDRESS) at Aug 18 12:30:10
Aug 18 12:33:31 nma postfix/anvil[23119]: statistics: max cache size 1 at Aug 18 12:30:10

I am runnning Debian X64 system.

Update

systemctl status apache2
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: active (exited) since Do 2016-08-18 13:03:44 CEST; 4s ago
  Process: 25676 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 25685 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)

Aug 18 13:03:44 nma apache2[25685]: Starting web server: apache2Action 'start' failed.
Aug 18 13:03:44 nma apache2[25685]: The Apache error log may have more information.
Aug 18 13:03:44 nma apache2[25685]: .
Aug 18 13:03:44 nma systemd[1]: Started LSB: Apache2 web server.
root@nma:/etc/apache2# ps -ef | grep apache2
root     25704 25545  0 13:04 pts/2    00:00:00 grep apache2

Error found

So, found this in /var/log/error.log

[Thu Aug 18 13:29:12.594218 2016] [ssl:emerg] [pid 26344:tid 140530931640192] AH02561: Failed to configure certificate domain.de:443:0, check /etc/letsencrypt/live/domain/cert.crt
[Thu Aug 18 13:29:12.594333 2016] [ssl:emerg] [pid 26344:tid 140530931640192] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: CERTIFICATE) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Thu Aug 18 13:29:12.594365 2016] [ssl:emerg] [pid 26344:tid 140530931640192] SSL Library Error: error:140AD009:SSL routines:SSL_CTX_use_certificate_file:PEM lib
AH00016: Configuration Failed

I have the same setup working when I am using Tomcat only, why is it failing for Apache?

cert.pem :

-----BEGIN CERTIFICATE-----
//Some random data
-----END CERTIFICATE-----

SSL configuration :

<VirtualHost *:443>
ServerName www.domain
ServerAlias domain
ProxyRequests off
ProxyPreserveHost On
<Proxy https://www.domain.de:8443/>
Order deny,allow
Allow from all
</Proxy>
 ProxyReceiveBufferSize 4096
SSLEngine on
SSLProxyEngine on
SSLCertificateFile /etc/letsencrypt/live/domain-0005/cert.crt
SSLCertificateKeyFile /etc/letsencrypt/live/domain-0005/private1.key
SSLCertificateChainFile /etc/letsencrypt/live/domain-0005/chain.pem

#ErrorDocument 503 /maintenance.html
# ErrorDocument 404 /maintenance.html
# ErrorDocument 500 /maintenance.html

#ProxyPass /maintenance.html !
ProxyPass / https://localhost:8443/
ProxyPassReverse / https://localhost:8443/

<Location / >
Order allow,deny
Allow from all
</Location>
</VirtualHost>

SCript used for converting letsencrypt certificates :

// Convert key to aes192 and set new password, important foor letsencrypt as the keys generated have no password.
openssl rsa -aes192 -in yourprivatekeywithoutpassword.pem -out newprivatekeywithpassword.pem

// Convert pem to crt. 
openssl x509 -outform der -in your-cert.pem -out your-cert.crt

// pem to key
openssl rsa -outform der -in private.pem -out private.key

openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -CAfile chain.pem -caname root -out fullchain_and_key.p12 -name tomcat

keytool -importkeystore -deststorepass PASS -destkeypass PASS -destkeystore MyDSKeyStore.jks -srckeystore fullchain_and_key.p12 -srcstoretype pkcs12 -srcstorepass PASS -alias tomcat

keytool -import -trustcacerts -alias root -file chain.pem -keystore MyDSKeyStore.jks
  • I think the answer lies in apachectl configtest, or whatever the apachectl is named in this Debian of yours. Debian team is widely known for reinventing the wheel. – drookie Aug 18 '16 at 10:48
  • Output for apachectl configtest : AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/ports.conf:5 Syntax OK,. – We are Borg Aug 18 '16 at 10:50
  • Remove it then, since it really has no sense in 2.4.x. May be it still affects the exit status. – drookie Aug 18 '16 at 10:57
  • Try running systemctl status apache2 – frlan Aug 18 '16 at 10:58
  • @frlan : Output posted in main post bottom, kindly check it out. – We are Borg Aug 18 '16 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.