12

Out of the blue, I can't restart apache on my CentOS 6.8 web server:

# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:7080
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:7080
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]

I tried a bunch of things I read online, including removing lock files.

I decided to try rebooting the server. After reboot, attempting to load any hosted websites would result in "502 Bad Gateway".

# service httpd status
httpd is stopped

# service httpd start
Starting httpd:                                            [  OK  ]

# service httpd status
httpd dead but subsys locked

Despite the "dead" status, I can now load websites!

Sometimes service httpd restart works...

# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

But other times it results in the first error above. In which case I can fix it with:

# killall -9 httpd
# service httpd start

So I can work around it, but I'm really curious about what is going on and wondering if I should be concerned.

2
  • Is your filesystem full? And: when the error comes up, run netstat -tulpen and look for anything listening on port 7080. You only run apache, right? The 7080 port is not a mistake?
    – Lenniey
    Dec 2, 2016 at 7:44
  • tcp 0 0 :::7080 :::* LISTEN 0 5626801 3829/httpd
    – stevland
    Dec 5, 2016 at 22:35

2 Answers 2

12

You may have defined your listener on that port twice in your configs somewhere.

Listen *:7080

If you run an Apache config test, it will say the config is OK, until you actually restart the service, it will fail with a similar error to what you are seeing.

Also verify your logging location exists and is writable and has space to write, that message at the end is suspect.

9

SSH to the server and the run the following:

setenforce 0

This will disable selinux until next reboot

Then try to reload Apache

service httpd restart

If this works somehow selinux got turned on.

To disable permanently follow this link:

https://kb.plesk.com/en/115626

2
  • As much as I love easy answers, unfortunately, it didn't work. :(
    – stevland
    Dec 5, 2016 at 22:38
  • Can you run these commands to see what is using what ports. Please either add output to question or pastebin. "netstat -ano | grep 80" "netstat -ano | grep 7080" "cat /etc/services | grep -w 80" "cat /etc/services | grep -w 7080" "nmap localhost | grep 80" "nmap localhost | grep 80" "nmap localhost" Dec 6, 2016 at 1:57

You must log in to answer this question.

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