Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I can't set the vhost config for a subdomain. When I put something in it like

<VirtualHost *:80>
    ServerName redmine.website.de
    ServerAdmin webmaster@localhost
    DocumentRoot /usr/share/redmine/public
</VirtualHost>

and reconfigure vhost I get the error message

<VirtualHost> cannot occur within <VirtualHost> section

I have look through every config file, apache2.conf, httpd.conf and through all files in /sites-xxx. The syntax is always correct.

enter image description here

When I put a </VirtualHost> at the top:

enter image description here

Any idea how I can solve this?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

My first guess is that the file you're editing is being included by another file, but from inside a virtualhost directive or you just need to look at all the other files in your conf.d (especially the ones that get loaded before the one you're working on) and make sure that all of them are closing their virtualhost directives. If you try to do </virtualhost> in this extra config file, even though the apache worked before you started adding this new virtualhost, there's a good chance that the necessary </virtualhost> exists somewhere in a later file or inside the file that includes conf.d. An extraneous closing tag is just as invalid as a nested virtualhost, apparently.

share|improve this answer
    
actually the vhost file I am editing is included by the the conf/http.include of the domain mysite.com. But I cant edit the http.include because it is generated by plesk every time I reconfigure vhost... –  ArtWorkAD Aug 11 '11 at 14:09
    
You may just need to look for a different way to add a virtualhost then. Can you do it from plesk? –  andyortlieb Aug 11 '11 at 15:20

First thing to do is put a </VirtualHost> directive immediately before your vhost definition e.g.

</VirtualHost>
<VirtualHost *:80>
    ServerName redmine.website.de
    ServerAdmin webmaster@localhost
    DocumentRoot /usr/share/redmine/public
</VirtualHost>

If that fixes the problem or you get a different error message then you have a <VirtualHost> without a closing </Virtualhost> somewhere in your config.

EDIT

The only way I can make your original error message occur is to have a complete

<VirtualHost *:80>
   ...
</VirtualHost> 

definition inside an include file which is included from within a <VirtualHost> definition.

share|improve this answer
    
Have a look at my updated question. –  ArtWorkAD Aug 10 '11 at 17:36
    
@ArtWorkAD: See my edit –  Iain Aug 10 '11 at 18:28

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.