Skip to content
Home » Linux » Address already in use: make_sock: could not bind to address 0.0.0.0:80

Address already in use: make_sock: could not bind to address 0.0.0.0:80

make_sock: could not bind to address 0.0.0.0:80

After installing SSL certificate, I rebooted the system, and I knew the process which ran httpd might be wrongly started at system startup, because starting httpd requires pass phrase of the private key, httpd is no way to know it. So we need to restart httpd. But we met the error like the following.

[root@test ~]# service httpd status
httpd (pid 1394) is running...
[root@test ~]# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]

This error told us that httpd failed to stop and start, and most important of all, I saw one root process but no child processes of httpd to service the public. This root process is problematic.

[root@test ~]# ps -ef | grep 1394
root      1394  1393  0 03:37 ?        00:00:00 /usr/sbin/httpd
...

Solution

Since the process was wrongly started, we should abandon the process.

[root@test ~]# kill -9 1394

We can expect that the pass phrase of the private key is required to enter when we start the service.

[root@test ~]# service httpd start
Starting httpd: Apache/2.2.26 mod_ssl/2.2.26 (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.

Server www.example.com:443 (RSA)
Enter pass phrase:

OK: Pass Phrase Dialog successful.
                                                           [  OK  ]
[root@test ~]# service httpd status
httpd (pid  1511) is running...

Now, the web server is accessible again.

Leave a Reply

Your email address will not be published. Required fields are marked *