# \[SOLVED\] Error while running apache2ctl configtest

**URL:** <https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739>\
**Category:** Help\
**Created:** [December 27, 2016, 1:36pm UTC](https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739 "2016-12-27T13:36:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![souvikghosh2701](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/souvikghosh2701/32/7739_2.png) [@souvikghosh2701](https://community.letsencrypt.org/u/souvikghosh2701)\
**Post date:** [December 27, 2016, 1:36pm UTC](https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739/1 "2016-12-27T13:36:31Z")

</div>

My domain is: [www.example.com](http://www.example.com) (LET IT BE THE DUMMY DOMAIN - PRIVACY)

I ran this command:

> sudo letsencrypt --apache -d [example.com](http://example.com) -d [www.example.com](http://www.example.com) -d [billing.example.com](http://billing.example.com) -d [forums.example.com](http://forums.example.com)

It produced this output:

```
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 18 of /etc/apache2/sites-enabled/billing.example.com-le-ssl.conf: Expected </VirtualHost> but saw </VirtualHost></IfModule>

```

My operating system is (include version): **Ubuntu v14.04 x64**

My web server is (include version): **Apache (Maybe v2.0 - I don't know exactly)**

My hosting provider, if applicable, is: **DigitalOcean**

I can login to a root shell on my machine (yes or no, or I don't know): **Yes**

Help Me., What to do..

I do have these files on /etc/apache2/sites-available :  
example.com.conf | billing.example.com.conf | forum.example.com.conf

Contents of example.com.conf :

> \< VirtualHost \*:80\>  
> ServerAdmin [webmaster@example.com](mailto:webmaster@example.com)  
> ServerName [example.com](http://example.com)  
> ServerAlias [www.example.com](http://www.example.com)

> ```
> <Directory /var/www/html/>
> Options Indexes FollowSymLinks
> AllowOverride All
> Require all granted
> </Directory>
> 
> ```

> ```
> DocumentRoot /var/www/html
> ErrorLog ${APACHE_LOG_DIR}/errormain.log
> CustomLog ${APACHE_LOG_DIR}/accessmain.log combined
> 
> ```
> 
> \< /VirtualHost\>

Contents of billing.example.com.conf :

> \< VirtualHost \*:80\>  
> ServerAdmin [webmaster@example.com](mailto:webmaster@example.com)  
> ServerName [billing.example.com](http://billing.example.com)

> ```
> <Directory /var/www/html/billing/>
> Options Indexes FollowSymLinks
> AllowOverride All
> Require all granted
> </Directory>
> 
> ```

> ```
> DocumentRoot /var/www/html/billing
> ErrorLog ${APACHE_LOG_DIR}/errorbilling.log
> CustomLog ${APACHE_LOG_DIR}/accessbilling.log combined
> 
> ```
> 
> \< /VirtualHost\>

Atlast the contents of forums.example.com.conf

> \< VirtualHost \*:80\>  
> ServerAdmin [webmaster@example.com](mailto:webmaster@example.com)  
> ServerName [forums.example.com](http://forums.example.com)

> ```
> <Directory /var/www/html/forums/>
> Options Indexes FollowSymLinks
> AllowOverride All
> Require all granted
> </Directory>
> 
> ```

> ```
> DocumentRoot /var/www/html/forums
> ErrorLog ${APACHE_LOG_DIR}/errorforums.log
> CustomLog ${APACHE_LOG_DIR}/accessforums.log combined
> 
> ```
> 
> \< /VirtualHost\>

Help Me Homies..!!

---

<div class="post-metadata">

**Author:** ![serverco](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/serverco/32/4251_2.png) [@serverco](https://community.letsencrypt.org/u/serverco)\
**Post date:** [December 27, 2016, 1:42pm UTC](https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739/2 "2016-12-27T13:42:58Z")

</div>

Without the real data it's always more difficult.

From the error;

> [@souvikghosh2701](#):
>
> Expected \</VirtualHost\> but saw \</VirtualHost\>\</IfModule\>

however in your listing of the file for billing.example.com.conf then there is no \</IfModule\>

If you manually run

> apache2ctl configtest

Can you look at the output and debug the errors ?

---

<div class="post-metadata">

**Author:** ![souvikghosh2701](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/souvikghosh2701/32/7739_2.png) [@souvikghosh2701](https://community.letsencrypt.org/u/souvikghosh2701)\
**Post date:** [December 27, 2016, 2:54pm UTC](https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739/3 "2016-12-27T14:54:10Z")

</div>

The output of apache2ctl configtest was **Syntax OK**

---

<div class="post-metadata">

**Author:** ![serverco](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/serverco/32/4251_2.png) [@serverco](https://community.letsencrypt.org/u/serverco)\
**Post date:** [December 27, 2016, 2:55pm UTC](https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739/4 "2016-12-27T14:55:47Z")

</div>

If running the certbot again - do you still get the same error ? i.e.

> [@souvikghosh2701](#):
>
> Error while running apache2ctl configtest.  
> Action 'configtest' failed.

---

<div class="post-metadata">

**Author:** ![souvikghosh2701](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/souvikghosh2701/32/7739_2.png) [@souvikghosh2701](https://community.letsencrypt.org/u/souvikghosh2701)\
**Post date:** [December 27, 2016, 3:04pm UTC](https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739/5 "2016-12-27T15:04:43Z")

</div>

Sadly “YES” - It’s all the same,.

---

<div class="post-metadata">

**Author:** ![serverco](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/serverco/32/4251_2.png) [@serverco](https://community.letsencrypt.org/u/serverco)\
**Post date:** [December 27, 2016, 3:19pm UTC](https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739/6 "2016-12-27T15:19:25Z")

</div>

Interesting that it gives the error when run via certbot, but not when run directly.

Can you provide the full log ( including domain name etc - as it’s in the public domain ) in [pastebin.com](http://pastebin.com) please ( you can always delete it again afterwards, and also the files it complains about - /etc/apache2/apache2.conf and /etc/apache2/sites-enabled/billing…com-le-ssl.conf

---

<div class="post-metadata">

**Author:** ![souvikghosh2701](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/souvikghosh2701/32/7739_2.png) [@souvikghosh2701](https://community.letsencrypt.org/u/souvikghosh2701)\
**Post date:** [December 28, 2016, 5:05am UTC](https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739/7 "2016-12-28T05:05:13Z")

</div>

I’ve just changed the subdomains

billing -\> members  
forums -\> community

And This worked like a charm., weird but., working., that’s all I want 🙂

Thank you anyways

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [January 27, 2017, 5:05am UTC](https://community.letsencrypt.org/t/solved-error-while-running-apache2ctl-configtest/24739/8 "2017-01-27T05:05:25Z")

</div>

Closed on January 27, 2017, 5:05am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
