Score:1

Apache Server Error After Setting Up SSL Configs

be flag

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
Score:0
be flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.