12

I am trying install apache2,i faced this problem.Give me some solutions

Restarting web server apache2 gives the error:

    AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
[fail]
 * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
3
  • Could you post your apache configuration file?
    – Lety
    Jul 22, 2014 at 20:15
  • sorry,how to get the apache configuration file?
    – narru033
    Jul 25, 2014 at 9:37
  • It should be /etc/apache2/apache2.conf, /etc/apache2/sites-enabled/000-default.conf and if you have defined your /etc/apache2/sites-available/yourFile.conf
    – Lety
    Jul 25, 2014 at 10:24

8 Answers 8

12

Run

sudo netstat -tulpn | grep :80

and you will get output something like

tcp        0      0 0.0.0.0:80         0.0.0.0:*      LISTEN     1066/lighttpd

note the pid of the process listening to the port, in my case it was 1066. Then run

sudo kill -9 1066

Remember to change the pid to the one that is listening to the port, It might not be the same as 1066

2

What type of server are you running this on?

To resolve the first error

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

You will need to edit httpd.conf file, add this line:

ServerName localhost

To resolve the other errors you should make sure that you are trying to run Apache with root privileges.

sudo /usr/sbin/apachectl start
3
  • 1
    This wasn't their real error.
    – Thomas Ward
    Jul 30, 2015 at 23:01
  • I don't have a httpd.conf file. Can I put that line into apache2.conf?
    – JohnK
    Mar 30, 2016 at 19:11
  • Setting ServerName in httpd.conf has no effect.
    – Cerin
    Aug 10, 2017 at 19:28
1

Like many server applications, you can't bind to a port already bound to by another application (in this case, port 80, for http). The cause of your error is that Apache can't bind to port 80 because something else is already listening there.

Run sudo netstat -tulpn | grep :80 and look for the name of the process that's listening on port 80. Then, either reconfigure or remove that program.

1

I have this same problem.

I tried to install LAMP on WSL by following this blog: LAMP on WSL but when I issued this command :

/etc/init.d/apache2 start  

I got this same error:

 * Starting Apache httpd web server apache2                                                                             
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
*

I had previously tried to install Nginx on Windows proper and failed but I remembered I had bound Nginx to port 80. Problem is I am no Linux expert and I could not see in apache2 conf file the area to bind to a port.

I tried running:

sudo netstat -tulpn | grep :80

and got nothing. I had also forwarded the port in my router so I could not understand how to solve the error.

I know Nginx was not running so port 80 should have been fine except for chrome which I assume was also running on port 80 So in frustration not knowing what will happen I proceeded the command with sudo like this:

sudo  /etc/init.d/apache2 start  

and I got:

 * Starting Apache httpd web server apache2                                                                              
 *

By proceeding the start command with sudo, Apache2 has authority to run. This is a short-term solution because it is not advisable to run Apache2 with root privileges (so we are informed) so the solution is still out there but for now, I can at least proceed with my tests.

If anyone knows the solution do please let us know.

4
  • @Yufenyuy thanks. I tried to catch all the codes but ...
    – seanbw
    Oct 9, 2018 at 8:36
  • ...@seanbw you're welcome. That's why we're in a community... Oct 9, 2018 at 8:49
  • @Yufenyuy The edits I get. Most. can you give me a link that teaches me how to tag words like sudo as part of a sentence because I see that sudo has its own format but its not on a separate line. Thanks
    – seanbw
    Oct 9, 2018 at 10:21
  • ...@seanbw you can enclose the word between ` and ` example sudo, for it to have that format... hope you get it clear. Oct 9, 2018 at 11:13
0

You may installed a new web server or anything reserve the port 80 check your services and what you have newly installed

0

In my case this was not a problem with logs, but actually with the Listen directive - it was set to Listen on an IP that did not exists (as I moved my laptop to another network).

This only surfaced after I uninstalled the service, reinstalled it and it said:

(OS 10049) The requested address is not valid in its context. : AH00072: make_sock: could not bind to address 0.0.0.0:80 AH00015: Unable to open logs

So I just commented out the offending Listen directive (and kept others) an voila.

I know the Q is about Ubuntu, but some other people might land here encountering the problem.

0

In my case, there was a ssl.conf which was under the conf.d directory which was causing the problem. If you have defined the Listen flag on your main httpd.conf file, you can rename the ssl.conf file to something

0

Tried https://askubuntu.com/a/923992/698546

But the program kept creating new processes as I killed an old one.

A simple restart of the server did the trick for me.

You must log in to answer this question.

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