Apache2: Expected </> but saw </VirtualHost>

Jacob Valenta picture Jacob Valenta · Mar 9, 2013 · Viewed 9.3k times · Source
Syntax error on line 14 of /etc/apache2/sites-enabled/mysite.org.conf: Expected </> but saw </VirtualHost>
Action 'start' failed.
The Apache error log may have more information.

And /etc/apache2/sites-enabled/mysitet.org.conf:

<VirtualHost *:80>
ServerName mysite.org
DocumentRoot /var/www/mysite_org

< Directory /var/www/mysite_org >
    Order allow,deny
    Allow from all
< /Directory >

WSGIDaemonProcess mysite_org processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup mysite_org

WSGIScriptAlias / /var/www/mysite_org/apache/django.wsgi
</VirtualHost>

Answer

Jacob Valenta picture Jacob Valenta · Mar 9, 2013

This error is actually caused by lines 5 and 8. Because the tag is opened with a space, the configuration assumes the tag is <> and should be closed with . Because <Directory> and </Directory> both have spaces, it assumes you open <> twice.

Simply remove spaces before the tag name, and Apache should restart with no problem.

<Directory /var/www/mysite_org>
    Order allow,deny
    Allow from all
</Directory >