Mishagen's picture

I do not know what has happened but my server has lost the apache configuration and it is not possible to make it work. Is there any way to restore my apache configuration to the default in Turnkey Linux?

 

this is my current error status:

root@lamp ~# systemctl status apache2.service 
* apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-01-28 12:04:41 UTC; 20s ago
  Process: 1100 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Jan 28 12:04:41 lamp systemd[1]: Starting The Apache HTTP Server...
Jan 28 12:04:41 lamp apachectl[1100]: (99)Cannot assign requested address: AH00072: make_sock: could not bind to address 80
Jan 28 12:04:41 lamp apachectl[1100]: no listening sockets available, shutting down
Jan 28 12:04:41 lamp apachectl[1100]: AH00015: Unable to open logs
Jan 28 12:04:41 lamp apachectl[1100]: Action 'start' failed.
Jan 28 12:04:41 lamp apachectl[1100]: The Apache error log may have more information.
Jan 28 12:04:41 lamp systemd[1]: apache2.service: Control process exited, code=exited status=1
Jan 28 12:04:41 lamp systemd[1]: Failed to start The Apache HTTP Server.
Jan 28 12:04:41 lamp systemd[1]: apache2.service: Unit entered failed state.
Jan 28 12:04:41 lamp systemd[1]: apache2.service: Failed with result 'exit-code'.
 

Forum: 
Jeremy Davis's picture

If you are sure it's Apache config, then my guess is that you have 2 sites both trying to use port 80. Or perhaps something else altogether is using port 80?

To check that nothing else is already using port 80, try running this:

netstat -tlnp

And look for the line that shows port 80 (or post the output here if unsure).

The other thing to do is to check what virtualhost config is enabled. The easiest is to check the contents of /etc/apache2/sites-enabled, like this:

ls -l /etc/apache2/sites-enabled

That should show you which sites are enabled (the files in /etc/apache2/sites-enabled should be symlinks to files in /etc/apache2/sites-available). Feel free to post back here with that if you want more guidance. Then check the contents of that/those file/s. E.g.:

cat /etc/apache2/sites-available/000-default.conf

My guess is that within the enabled config you have 2 virtual host entries that start like this:

<VirtualHost *:80>

Add new comment