Reputation: 43
I keep getting an error when trying to start Apache:
</VirtualHost> without matching <VirtualHost> section
...referring to line 4 of the Apache config file listed below:
<VirtualHost 74.117.238.120:80>
ServerName www.mydomain.biz
DocumentRoot /var/www/mydomain
</VirtualHost>
<VirtualHost 74.117.238.120:80>
ServerName codejerk.mydomain.biz
DocumentRoot /var/www/codejerk
</VirtualHost>
<VirtualHost 74.117.238.120:80>
ServerName www.mydomain.tk
DocumentRoot /var/www/mydomain
</VirtualHost>
<VirtualHost 74.117.238.120:80>
ServerName codejerk.mydomain.tk
DocumentRoot /var/www/codejerk
</VirtualHost>
The 'Listen' and 'NameVirtualHost' directives are in the file that calls this one:
Listen 80
NameVirtualHost 74.117.238.120:80
This is driving me nuts-- clearly each VirtualHost block has an opening and closing tag...
Anyone have any ideas?
Thanks in advance!
Upvotes: 2
Views: 8832
Reputation: 702
apache2 displays this weird message when your configuration file has a BOM.
Most tools will hide/ignore the BOM, but you can easily detect it using command file
:
% file /etc/apache2/conf-available/maxclients.conf
/etc/apache2/conf-available/maxclients.conf: UTF-8 Unicode (with BOM) text
Upvotes: 1
Reputation: 51
This usually happens when you save vHost-files in PC/Windows format with '\r\n' instead of unix format '\n'. Saving these files again in unix format solves the problem.
Additionally it is required to remove the Byte Order Mark (BOM), if existing.
Upvotes: 5
Reputation: 43
I solved this by merging the contents of apache2/sites-available/default and /apache2/ports.conf into apache2/apache2.conf and removing the lines that were including these files.
Apparently something was out of whack with the order in which these other files were being included.
Upvotes: 0