I am having a really annoying issue where my newly created Apache Vhost is causing config error. I initially use cp command to copy existing and working vhost and just changed the DocumentRoot. Apache would fail to reload and restart.
Running apache2 -t results in error below:
apache2: Syntax error on line 220 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/sites-enabled/test.example.com.conf: /etc/apache2/sites-enabled/test.example.com.conf:1: <VirtualHost> was not closed.
Here is my vhost stripped to the bare bones (I am running this exact code):
<VirtualHost *:443>
ServerAdmin example@email.com
DocumentRoot /var/www/test
ServerName ddns.example.com
ServerAlias www.test.example.com
</VirtualHost>
If I disable this vhost Apache starts fine and no config errors are shows from apache2 -t command. I've gone and manually retyped the vhost opening/closing tags and checked for empty space. test directory does exist and has www-root:www-root ownership. What is causing this seemingly false error?