6

I have set up ubuntu server on an old pc with webmin as well. I am not sure what was going on but i restarted the server and when it boots it now get this when Apache tries to start.

 * Starting web server apache2
apache2: Syntax error on line 237 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/000-default: No such file or directory
Action 'start' failed.
The Apache error log may have more information.

I have checked this file on this line and it looks like this:

# Include the virtual host configurations:
Include sites-enabled/

I have removed Apache and re installed it but not sure why it still fails.

Qben
  • 2,617
  • 2
  • 24
  • 36
Ryan King
  • 85
  • 1
  • 1
  • 7
  • That doesn't look like your apache log, check /var/log/apache2 or /var/log/httpd – emsworth Oct 09 '13 at 13:53
  • @emsworth this is what i get in the command line i have managed to get to the log and there no entries for the time around when i did try – Ryan King Oct 09 '13 at 14:01
  • I'm not sure I fully understand, does the file "/etc/apache2/sites-enabled/000-default" actually exist? If it does, is it a symlink or a file? If it is a symlink, what does it point to? – emsworth Oct 09 '13 at 14:15
  • @emsworth the file does exist in the sites-enabled folder i checked it am it is a symlink. it is pointing to the ..sites-available/default the only file or folder in the sites-available folder is default-ssl do i just change this to the other file in the folder called kooserver.conf? – Ryan King Oct 09 '13 at 14:20
  • The symlink will need to point to something valid, if kooserver.conf is your configuration, then yes. Apache includes everything in the sites-enabled directory, and typically the sites-enabled just contains symlinks to the sites-available directory. This makes it easy to enable and disable sites by adding or removing symlinks, rather than modifying the site configuration files or file locations. – emsworth Oct 09 '13 at 14:22
  • @emsworth i have changed it too kooserver and kooserver.conf and it still does the same – Ryan King Oct 09 '13 at 14:28
  • Can you show the output of "ls -l /etc/apache2/sites-enabled" and "ls -l /etc/apache2/sites-available"? – emsworth Oct 09 '13 at 14:32
  • I have just tried this which i have just found on a forum: root@kooserver:~# sudo a2ensite default ERROR: /etc/apache2/sites-enabled/000-default is a dangling symlink! ERROR: Site default does not exist! – Ryan King Oct 09 '13 at 14:33
  • remove the symlink to default in the sites-enabled – emsworth Oct 09 '13 at 14:35
  • root@kooserver:~# ls -l /etc/apache2/sites-enabled total 0 lrwxrwxrwx 1 root root 26 Oct 9 15:26 000-default -> ../sites-available/default lrwxrwxrwx 1 root root 43 Oct 9 14:07 kooserver.conf -> /etc/apache2/sites-available/kooserver.conf – Ryan King Oct 09 '13 at 14:35
  • root@kooserver:~# ls -l /etc/apache2/sites-available total 12 -rw-r--r-- 1 root root 7469 Feb 7 2012 default-ssl -rw-r--r-- 1 root root 156 Oct 9 15:10 kooserver.conf – Ryan King Oct 09 '13 at 14:35
  • @emsworth do you mean delete the file? – Ryan King Oct 09 '13 at 14:36
  • yes, remove sites-enabled/default, it's not pointing to anything – emsworth Oct 09 '13 at 14:38
  • I have removed it but i now get another error: Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName NameVirtualHost 192.168.1.22:0 has no VirtualHosts NameVirtualHost *:80 has no VirtualHosts (99)Cannot assign requested address: make_sock: could not bind to address 192.168.1.22:90 no listening sockets available, shutting down Unable to open logs Action 'start' failed. The Apache error log may have more information. – Ryan King Oct 09 '13 at 14:41
  • That's a whole different issue, probably best to open a new question or search existing ones for the appropriate answer on this site. – emsworth Oct 09 '13 at 14:43

3 Answers3

4

You do not have a default site enabled:

/etc/apache2/sites-enabled/000-default: No such file or directory

site-enabled should contain symlinks to files in site-available and I guess your 000-default symlink does not link to a real file in site-available.

I guess this Ubuntu guide might be of interest for you.

Qben
  • 2,617
  • 2
  • 24
  • 36
  • Thanks I have just looked in the sites-enabled folder and there is a file called "000-default" and in the "site-available" folder there is the following files. "default-ssl" and kooserver.conf – Ryan King Oct 09 '13 at 14:06
4

As also answered by Qben, the issue was an invalid symlink in the sites-enabled folder. Removing the broken symlink and adding a valid one will fix the issue.

emsworth
  • 1,149
  • 10
  • 21
2

One of the reason may be that you might have some site that is not enabled.To check that

  1. Go to /etc/apache2/sites-enabled
  2. Out of many/some [sitename].conf files , one/some may be crossed
  3. Delete those found crossed
  4. Restart apache server

    sudo service apache2 restart.

Hope this has helped you , but may be some other reason too. Thank you.