Ubuntu – Cannot Start Apache2

Apache2networkingserver

I'm trying to install apache2 (To set up a LAMP stack), but something appears to be using the HTTP port on 0.0.0.0:80.

There is also a text post about not being able to determine the server's fully qualified name.

Here is the full post:

invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Wed 2019-05-22 15:57:55 UTC; 10ms ago
  Process: 28139 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

May 22 15:57:55 scilab_comp_0 apachectl[28139]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.222. Set the 'ServerName' directive globally to suppress this message
May 22 15:57:55 scilab_comp_0 apachectl[28139]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
May 22 15:57:55 scilab_comp_0 apachectl[28139]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
May 22 15:57:55 scilab_comp_0 apachectl[28139]: no listening sockets available, shutting down
May 22 15:57:55 scilab_comp_0 apachectl[28139]: AH00015: Unable to open logs
May 22 15:57:55 scilab_comp_0 apachectl[28139]: Action 'start' failed.
May 22 15:57:55 scilab_comp_0 apachectl[28139]: The Apache error log may have more information.
May 22 15:57:55 scilab_comp_0 systemd[1]: apache2.service: Control process exited, code=exited status=1
May 22 15:57:55 scilab_comp_0 systemd[1]: apache2.service: Failed with result 'exit-code'.
May 22 15:57:55 scilab_comp_0 systemd[1]: Failed to start The Apache HTTP Server.
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for systemd (237-3ubuntu10.21) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ...
Rules updated for profile 'OpenSSH'

With regards to the server's domain name. I just created a domain name for it using my router's function for DDNS and have made this server a DMZ by forwarding all ports to it.

How should I go about resolving the issue and get Apache to start?

EDIT 0:

sarah@scilab_comp_0:~$ sudo netstat -tlpn | grep :80
tcp6       0      0 :::80            :::*              LISTEN      3034/httpd 

Best Answer

  • you can see all the processes that are using port 80 at the time you are starting apache2 :

    sudo lsof -i TCP:80
    

    and also I think the easiest way to resolve the problem you are facing is to change your port to something else , you can change them in this two files in your apache 2 configs:

    /etc/apache2/ports.conf 
    /etc/apache2/sites-enabled/000-default.conf 
    

    after these you should restart the apache2 with this command :

     sudo /etc/init.d/apache2 restart
    

    also for getting better result you can run this command to see whats missing or making problem in starting apache2:

     systemctl status apache2.service