4

I have been using Apache2 and webmin with my Raspberry Pi. After a restart and reinstallations Apache won't start.

> sudo /etc/init.d/apache2 restart
apache2: Syntax error on line 268 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/000-default: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
failed!

The file 000-default is there and unopenable permisions to root-root. My apache2.conf file looks like this (bottom half).

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel debug

# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf

# Include list of ports to listen on and which to use for name based vhosts
Include ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see the comments above for details.

# Include generic snippets of statements
Include conf.d/

# Include the virtual host configurations:
Include sites-enabled/
<VirtualHost *:80>
DocumentRoot /var/www
<Directory /var/www>
allow from all
Options +Indexes
</Directory>
ServerName IMASERVER
</VirtualHost>

Does anyone know what is the cause of this?

  • 1
    What is the output of ls -l /etc/apache2/sites-enabled? – Alex Chamberlain Oct 8 '12 at 6:36
  • 1
    And could you mark which line is 268 in your apache2.conf ? – Krzysztof Adamski Oct 8 '12 at 6:48
  • > ls -l /etc/apache2/sites-enabled total 0 lrwxrwxrwx 1 pi root 26 Oct 8 03:52 000-default -> ../sites-available/default @alex – enrique2334 Oct 8 '12 at 6:48
4

All of the files in the sites-enabled/ directory are actually symlinks to their counterparts in the sites-available/ directory.

For some reason it looks as if the file that 000-default is linked to is not there any more. You should be able to tell if I'm right by executing the following, which I think will give you some errors about dangling symlinks:

sudo a2ensite default

That command essentially renews the symlinks between the two directories. So, the default site configuration is broken, but it's not actually needed. You can safely delete the contents of /etc/apache2/sites-enabled:

sudo rm /etc/apache2/sites-enabled/000-default

The apache2.conf file already contains a site configuration at the bottom, so it should work without any sites enabled, but add any new sites into the sites-available/ directory and enable them with the a2ensite.

  • 2
    You were right about the error. > sudo a2ensite default ERROR: /etc/apache2/sites-enabled/000-default is a dangling symlink! ERROR: Site default does not exist! I'll test out your solution in the morning.(I'm on my iPhone now) – enrique2334 Oct 8 '12 at 7:32
  • @enrique2334: Glad I could help :) – Jivings Oct 8 '12 at 7:39

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.