0

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?

DarkLeafyGreen
  • 273
  • 5
  • 7
  • 23

2 Answers2

3

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.

user9517
  • 114,104
  • 20
  • 206
  • 289
3

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.

andyortlieb
  • 1,052
  • 1
  • 12
  • 25
  • 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... – DarkLeafyGreen 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