1

I am running an EC2 Linux 2 AMI and was following an AWS tutorial to enable HTTPS on my server.

But when I try to restart Apache, error seen in the logs:

Apr 10 06:56:40 <maskediphere> systemd[1]: Starting The Apache HTTP Server... Apr 10 06:56:40 <maskediphere> httpd[30696]: (98)Address already in use: AH00072: make_sock: could not bind t...:]:80 Apr 10 06:56:40 <maskediphere> httpd[30696]: (98)Address already in use: AH00072: make_sock: could not bind t....0:80 Apr 10 06:56:40 <maskediphere> httpd[30696]: no listening sockets available, shutting down Apr 10 06:56:40 <maskediphere> httpd[30696]: AH00015: Unable to open logs Apr 10 06:56:40 <maskediphere> systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE Apr 10 06:56:40 <maskediphere> systemd[1]: Failed to start The Apache HTTP Server. Apr 10 06:56:40 <maskediphere> systemd[1]: Unit httpd.service entered failed state. Apr 10 06:56:40 <maskediphere> systemd[1]: httpd.service failed.

How To Reproduce: Using the ssl.conf code (linked below), run the command "sudo systemctl restart httpd".

Output of this command: Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

Desired behaviour: The Apache server should restart, but the server is not restarting despite the fact that the Apache server (httpd service) is actually running on the machine.

I've tried many things so far including:

  1. Ensuring my certificate is named as a .pem file
  2. Same .pem file reference is in my ssl.conf file in /etc/httpd/conf.d/ directory
  3. Commented out the SSLCertificateKeyFile

Resources:

  1. ssl.conf file code
  2. List of available running services on each port: List of available running services on each port

1 Answer 1

0

I resolved this issue, for anyone facing something similar, try this:

  1. Enter lsof -i :80 in your terminal - this will list down all your running process ID's on the given port number (you can replace 80 with any port number. In my case, I put in 80 because my Apache service was running on this port). Once you see the list of the running process ID's, find the ID of Apache (httpd). There might be multiple process IDs under httpd, in this case copy/remember the one at the top of the list.

  2. Enter sudo kill -9 process_id - replace process_id with the ID you noted from step 1. This will kill/stop the Apache service.

  3. Enter sudo systemctl start httpd - this will start the Apache/httpd server again

Do be careful and note: if you're running a server which has live users, they might be affected if step 3 doesn't work for you and step 2 has already killed the service. In my case, everything was fine but it seems like the sudo systemctl restart httpd command just wasn't working until I manually killed the running process ID and started Apache again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .