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


i’m trying to use letsencrypt and facing the following exception:
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 9 of /etc/apache2/sites-enabled/ Expected </VirtualHost> but saw </VirtualHost></IfModule>"

Command line input: sudo -H ./letsencrypt-auto --redirect --rsa-key-size 4096
-> The reason for using -H is facing the warning "The directory ‘/home/myUser/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag."
OS: Ubuntu 15.10
Current vHost file (its only one):
<VirtualHost *:80>
ServerAdmin my@mail.address
DocumentRoot /var/content/webstuff

Do you have any ideas how to solve this?

Hi Markus,

The specific error has come up 3 times on the forum I think. Unfortunately I’ve never seen a solution to exactly what is causing that. It will be something to do with the files in /etc/httpd/sites-available probably ( since they are generally sym linked over to the sites-enabled folder). is this a relatively clean install of ubuntu 15.10 ? without any other control panel or anything that will modify apache ?

your assumption is correct, there is no control panel for apache installed. Nearly clean installation.

In the available-sites only the vFile I’ve posted and the default conf.
Can you please provide me the links to the other solutions? Maybe one of them can fix my problem too…

Edit: is it possible that the owncloud server can cause this issue? It creates folder alongside with the HTML folder /var/content/owncloud

Regards, Markus

Other posts are at Error Running Client: Expected /VirtualHost but saw /Virtual.Host/IfModule
and Issue creating certificate for OwnCloud?

So yes, could be owncloud related …

I solved my problem by configuring my apache by myself. The certificates are available on the Hard disk and so I’ve used them.
The renewal of these certificates could be the next issue, but the process in the gui had a option for renewal and I will test it when the days of the current certs are counted.

Excellent, glad to know you have resolved it.

Do you know what part of the original config it was that caused the problem ?

Hopefully the renewal will be easy now that you have sorted out the apache config.

I do not know which part of the original config caused the problem :frowning:
But i think oc made some changes to the file too and this part will cause the problem - but i dont kow for sure.