Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

For using my Debian VPS for multiple domains , I did such actions:

removed the default one from sites-enabled/ and sites-available/ (config and the symbolic link) and I added this under sites-available/ :

<VirtualHost MYIP:80>
Alias /media/ /home/myuser/mysite/media/
Alias /admin_media/ /home/myuser/django/Django-1.2/django/contrib/admin/media/
WSGIScriptAlias / /home/myuser/mysite/
ErrorLog  /home/myuser/mysite/logs/error.log
CustomLog /home/myuser/mysite/logs/access.log combined

And I have changed my ports.conf to:

NameVirtualHost MYIP:80
Listen 80

<IfModule mod_ssl.c>
    # SSL name based virtual hosts are not yet supported, therefore no
    # NameVirtualHost statement here
    Listen 443

Lastly I enabled the new domain via the command:


After restart I get this error:

myuser:~# /etc/init.d/apache2 restart
Restarting web server: apache2apache2: Syntax error on line 281 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/sites-enabled/ /etc/apache2/sites-enabled/ <VirtualHost> was not closed.

Please help this poor soul.

share|improve this question

2 Answers 2

The file /etc/apache2/sites-enabled/ contains the configuration for the virtual host

The file should begin with


which should be followed by various configuration options. There should be a closing


at the bottom.

Check that there is a suitably placed </VirtualHost>

share|improve this answer

This error:

[...] <VirtualHost> was not closed.

seems to be about your config being improperly formatted. Are you sure you didn't miss some slash/spelling mistake in the actual config? The provided snippet looks OK though, so I'm not sure why you would have something like this. By the way, what DocumentRoot are you using for your virtual hosts?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.