CentOS 7: Apache Wont start after configuring virtualhost

Operating System CentOS7 not available, so I chose CenOS/RHEL 6 but this only applies to CentOS 7

I setup a test virtual host on a new install of Virtualmin on CentOS 7, and shortly after noticed Apache was not running. On attempting to start it I got:


Failed to start service :
Redirecting to /bin/systemctl start httpd.service
Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.

systemctl status httpd.service says:


[root@**** ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: failed (Result: exit-code) since Mon 2014-09-08 13:32:05 UTC; 6min ago
Process: 16130 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 16942 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
Process: 16129 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 16129 (code=exited, status=1/FAILURE)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"

Sep 08 13:32:05 ****.******.com systemd[1]: Starting The Apache HTTP Server...
Sep 08 13:32:05 ****.******.com httpd[16129]: (98)Address already in use: AH00072: make_sock: could not bind to address ***.***.***.***:443
Sep 08 13:32:05 ****.******.com httpd[16129]: no listening sockets available, shutting down
Sep 08 13:32:05 ****.******.com httpd[16129]: AH00015: Unable to open logs
Sep 08 13:32:05 ****.******.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Sep 08 13:32:05 ****.******.com systemd[1]: Failed to start The Apache HTTP Server.
Sep 08 13:32:05 ****.******.com systemd[1]: Unit httpd.service entered failed state.

journalctl -xn says:


Sep 08 14:04:19 ****.*******.com systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Sep 08 14:04:19 ****.*******.com httpd[17949]: (98)Address already in use: AH00072: make_sock: could not bind to address ***.***.***.***:443
Sep 08 14:04:19 ****.*******.com httpd[17949]: no listening sockets available, shutting down
Sep 08 14:04:19 ****.*******.com httpd[17949]: AH00015: Unable to open logs
Sep 08 14:04:19 ****.*******.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Sep 08 14:04:19 ****.*******.com systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Sep 08 14:04:19 ****.*******.com systemd[1]: Unit httpd.service entered failed state.

Status: 
Closed (fixed)

Comments

/etc/httpd/conf.d/ssl.conf contained the following


#
# When we also provide SSL we have to listen to the
# the HTTPS port in addition.
#
Listen 443 https
Listen ***.***.***.***:443

(Real external IP replaced with ***.***.***.***)

It was trying to bind twice to 443, commenting out the second line allowed Apache to start

I also noticed this bug yesterday, and have implemented a fix for inclusion in the next Virtualmin release (4.11). The cause is that the first Listen line has a port name at the end of it (https) which confuses Virtualmin.

The fix is simply to change the line to :

Listen 443

and remove the second Listen with the IP address in it.

Automatically closed -- issue fixed for 2 weeks with no activity.