[SOLVED] Error while running apache2ctl configtest

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

I ran this command:

sudo letsencrypt --apache -d example.com -d www.example.com -d billing.example.com -d 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
ServerName example.com
ServerAlias 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
ServerName 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
ServerName 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…!!

Without the real data it’s always more difficult.

From the error;

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 ?

1 Like

The output of apache2ctl configtest was Syntax OK

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

Sadly ā€œYESā€ - It’s all the same,.

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 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

I’ve just changed the subdomains

billing -> members
forums -> community

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

Thank you anyways

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