Error Running Client: Expected </VirtualHost> but saw </VirtualHost></IfModule>


#1

core.terragaming.co.uk.conf in sites-avaliable:

# core.terragaming.co.uk
<VirtualHost *:80>
ServerAdmin email@terragaming.co.uk
ServerName core.terragaming.co.uk
DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I have no idea if this is a problem with the client or my Apache configurations. Any help would be appreciated.


Syntax error in apache2.conf during script run on ubuntu 15.10
#3

I have the exact same problem, for just one of my sites. I hope you get an answer!


#4

Is there a core.terragaming.co.uk-le-ssl.conf file ? if so whats in that ? if not, what’s renaming things in the sites-enabled folder ? (some control panels rename files in different ways )


#5

There is no core.terragaming.co.uk-le-ssl.conf before the lets encrypt client runs, and it is deleted afterwards when the client reverts the changes after the error.
And i am not using any control panels, just a LAMP stack installed on Ubuntu 14.04.


#6

same problem here with fresh minimal debian 8.2 install + apache2 from repo and letsencrypt via git.

Edit: removed the server alias in the vhost config and everything works now!


#7

Tried removing the ServerAliases in all my vhosts, didn’t fix anything.


#8

I can only suggest -vvv on the command line and seeing if that provides some extra clues.


#9

Tried that, It scrolled through a bunch of normal logs, but once it started the ui, it went to quickly to read and there is no way to scroll up inside the ui.


#10

Anything in the apache log ?

You can also use the --text option to remove the GUI - then you should be able to scroll.


#11

Everything above whats pasted bellow seems normal, and there is nothing in /var/log/apache2/error.log…

2015-12-19 15:33:50,450:DEBUG:letsencrypt.error_handler:Encountered exception:
Traceback (most recent call last):
  File "/home/terra/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt/client.py", line 385, in deploy_certificate
    self.installer.restart()
  File "/home/terra/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt_apache/configurator.py", line 1221, in restart
    self.config_test()
  File "/home/terra/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt_apache/configurator.py", line 1244, in config_test

MisconfigurationError: Error while running apache2ctl configtest.
Action 'configtest' failed.
The Apache error log may have more information.

apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 14 of /etc/apache2/sites-enabled/core.terragaming.co.uk-le-ssl.conf: Expected </VirtualHost> but saw </VirtualHost></IfModule>


2015-12-19 15:33:50,452:DEBUG:letsencrypt.error_handler:Calling registered functions
2015-12-19 15:33:50,452:CRITICAL:letsencrypt.client:Rolling back to previous server configuration...
2015-12-19 15:33:50,620:INFO:letsencrypt.reporter:Reporting to user: We were unable to install your certificate, however, we successfully restored your server to its prior configuration.
2015-12-19 15:33:50,623:DEBUG:letsencrypt.cli:Exiting abnormally:
Traceback (most recent call last):
  File "/home/terra/.local/share/letsencrypt/bin/letsencrypt", line 11, in <module>
    sys.exit(main())
  File "/home/terra/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt/cli.py", line 1396, in main
    return args.func(args, config, plugins)
  File "/home/terra/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt/cli.py", line 561, in run
    lineage.chain, lineage.fullchain)
  File "/home/terra/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt/client.py", line 385, in deploy_certificate
    self.installer.restart()
  File "/home/terra/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt_apache/configurator.py", line 1221, in restart
    self.config_test()
  File "/home/terra/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt_apache/configurator.py", line 1244, in config_test
    raise errors.MisconfigurationError(str(err))

MisconfigurationError: Error while running apache2ctl configtest.
Action 'configtest' failed.
The Apache error log may have more information.

apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 14 of /etc/apache2/sites-enabled/core.terragaming.co.uk-le-ssl.conf: Expected </VirtualHost> but saw </VirtualHost></IfModule>

Error while running apache2ctl configtest.
Action 'configtest' failed.
The Apache error log may have more information.

apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 14 of /etc/apache2/sites-enabled/core.terragaming.co.uk-le-ssl.conf: Expected </VirtualHost> but saw </VirtualHost></IfModule>


IMPORTANT NOTES:
 - We were unable to install your certificate, however, we
   successfully restored your server to its prior configuration.

#12

Bump? Still can’t get this working…


#13

I can’t replicate it on my system, and not one I’ve come across ( the same for others I’d guess since you haven’t had lots of replies).

It might be worth flagging up as a bug on github - alternatively, try one of the many other clients


#14

Thanks for the help, I will try completely re-making the server box from scratch later and see if that fixes my issues.


#15

@groovyben008 Just seeing a common link of 2 others with the same issue … they had owncloud - are you using owncloud or anything that might be affecting the apache config in the same way ?


#16

Nope, using a new digitalocean droplet with a self-installed LAMP stack.


#17

This is happening to me as well, on a Debian VPS. I had it enabled for three domains with no issues, tried to add a fourth and began getting this.

Clearly, the script is at least temporarily writing out the le-ssl.conf. I’ve been trying for an hour to figure out if there is a way to get the script to output said file for me to review, but have had no luck at all.


#18

Still haven’t fixed this issue, so no ideas…


#19

Would you mind sharing your full apache config? Specifically, those files might be of interest:

  • /etc/apache2/apache2.conf
  • /etc/apache2/conf.d/*
  • /etc/apache2/sites-enabled/*
  • /etc/apache2/sites-available/*
  • Any other conf file anywhere (conf-enabled, mods-enabled, …) you might have modified or included from inside other conf files.

#20

I have pretty much the same problem. Ubuntu 14.04, apache2. Cleaninstall (well, phpmyadmin is installed) and just one virtual host conf file

<VirtualHost *:80 >
	ServerName www.mydomain.io
	ServerAlias mydomain.io
	ServerAdmin info@mydomain.io
	DocumentRoot "/var/www/projects/mydomain/public"
	ErrorLog "/var/www/projects/mydomain/logs"
</VirtualHost>

Removing the ServerAlias doesn’t change anything. Not sure what to do here? :frowning:

apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Syntax error on line 12 of /etc/apache2/sites-enabled/mydomain-le-ssl.conf: Expected </VirtualHost> but saw </VirtualHost></IfModule>

I uploaded my apache.conf to pastebin but I don’t think there’s anything wrong with it?! I checked all the files that get included in lines 216 & 219 and everything looks good to me. I tried to output the mydomain-le-ssl.conf file but I had no luck with that so far.

All the files in /sites-enabled/ are symlinks to their respective files in /sites-available/, shouldn’t it be the same for the le-ssl.conf?


#21

I had this problem as well. I solved it by pressing ENTER after and running the installation again.