0

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 
  • 1
    It's more or less an duplicate of this question. Run sudo netstat -tlpn | grep :80 and figure what is listening on port 80 today. Stop/disable that service, and start Apache. – vidarlo May 22 at 16:19
  • httpd is apache2...though that is how it is named on Red Hat flavors of linux. – rtaft May 22 at 16:31
  • @vidarlo It appears to be httpd. Hmm, no idea why/how the red hat version is present. How would I uninstall it? I ran sudo purge apache2 already. – Sarah Szabo May 22 at 16:32
  • 1
    dpkg -l | grep httpd – rtaft May 22 at 16:38
  • 1
    Within Ubuntu 16+ Apache2 (from the default repository) is named apache2 and the binary is /usr/sbin/apache2, so apparently this service httpd probably is another HTTPD service, but not Apache2, so try to find which is it (by using ps -aux | grep -i 'httpd' or which httpd) and stop and disable it (if you do not need it) then restart Apache2. In order to suppress the message AH00558: just add the directive ServerName <put here your primary domain or ip without the brackets> at the bottom of /etc/apache2/apache2.conf. – pa4080 May 22 at 16:49
0

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 
  • Changing the port off of 80 won't negatively affect people wanting to connect to it? I'm still learning how this works. Thanks for the post! – Sarah Szabo May 22 at 16:28
  • @SarahSzabo I had this error yesterday and with all the searches I came up with this solution and that worked for me , hope it works for you too – Zhivar Sourati May 22 at 16:36
  • @SarahSzabo Using a non-standard port will affect users, yes. If it's public-facing, you should probably look into using TLS as well... – vidarlo May 22 at 16:49
  • @SarahSzabo you can also find which process is using (listening) port 80 so you can kill the process , this one worked for me too. – Zhivar Sourati May 22 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.