Apache is no longer working EVEN after I installed and reinstalled it

I was trying to add SSL certificates to my service and all of the sudden apache stopped working. I've tried multiple solutions. so I though maybe I just need to completely uninstall and reinstall it. I won't restart or anything
that didn't work I am still getting the same error log as before. I've tried many solution and still nothing!

Nov 02 21:45:33 localhost apachectl[20710]: AH00558: apache2: Could >not reliably determine the server's fully qualified domain name, >using ::1. Set the 'ServerName' directive globally to suppress it

Nov 02 21:45:33 localhost apachectl[20710]: (98)Address already in >use: AH00072: make_sock: could not bind to address [::]:80

Nov 02 21:45:33 localhost apachectl[20710]: (98)Address already in >use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Nov 02 21:45:33 localhost apachectl[20710]: no listening sockets >available, shutting down

Nov 02 21:45:33 localhost apachectl[20710]: AH00015: Unable to open >logs

Nov 02 21:45:33 localhost apachectl[20710]: Action 'start' failed.

Nov 02 21:45:33 localhost apachectl[20710]: The Apache error log may >have more information.

Nov 02 21:45:33 localhost systemd[1]: apache2.service: Control
process exited, code=exited status=1

Nov 02 21:45:33 localhost systemd[1]: apache2.service: Failed with >result 'exit-code'.

Nov 02 21:45:33 localhost systemd[1]: Failed to start The Apache HTTP >Server.
lines 1-17/17 (END)

11 Replies

Can you post the output of:

  • sudo /usr/sbin/apachectl configtest (tests the configuration for sanity)
  • sudo /usr/sbin/apachectl -M (dumps loaded modules)
  • sudo /usr/sbin/apachectl -S (dumps virtual host configuration)

Put each piece of output between two rows of ``` (3 backticks). That will turn off the markdown processing and show the output as code (makes it easier to read).

I suspect the configuration is your problem…

-- sw

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

This should help:

https://www.digitalocean.com/community/tutorials/apache-configuration-error-ah00558-could-not-reliably-determine-the-server-s-fully-qualified-domain-name

Do you set ServerName globally (in /etc/apache2/apache2.conf) or in each of your VirtualHosts? If not, you should. ServerName should be a DNS-registered domain name for the host. Like this:

<VirtualHost _default_:80>

  # Admin email, Server Name (domain name), and any aliases
  #
  ServerAdmin postmaster@foo.com
  ServerName foo.com
  ServerAlias www.foo.com  # not needed if you don't have a DNS A/AAAA record for 'www'
  ServerSignature Off      # optional
  ...
</VirtualHost>

Certs typically depend on this info…

-- sw

@stevewi

sudo /usr/sbin/apachectl configtest

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

sudo /usr/sbin/apachectl -M

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 reqtimeout_module (shared)
 setenvif_module (shared)
 status_module (shared)

sudo /usr/sbin/apachectl -S

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 reqtimeout_module (shared)
 setenvif_module (shared)
 status_module (shared)
root@localhost:~# sudo /usr/sbin/apachectl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80                   ::1 (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

It looks like you don't have any VirtualHosts so you need to define it globally. Add

  # Admin email, Server Name (domain name), and any aliases
  #
  ServerAdmin postmaster@foo.com
  ServerName foo.com
  ServerAlias www.foo.com  # not needed if you don't have a DNS A/AAAA record for 'www'
  ServerSignature Off      # optional

somewhere in /etc/apache2.conf (at a place where you'll remember what it's for) & restart apache2.

-- sw

P.S. ServerAdmin doesn't have to be a valid email address…it just has to look like a valid email address. You can fix it later if you use a placeholder for it.

@stevewi
still doesn't work

Do you have another apache2 configuration file? If not, can you post your /etc/apache2.conf?

-- sw

I only have that file in
/etc/apache2/apache2.conf

Can you post the contents?

-- sw

Figured it out. i had nginx installed which was conflicting with apache2

Great!

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct