Virtualhost syntax error and Certbot failure

Not open for further replies.


Jan 2, 2016
1. Trying to get Nextcloud set up based on this guide. From within my LAN, the jail IP takes me to It Works! and MYURL.COM takes me to Secure Connection Failed

2. I am getting the following syntax error.

root@nextcloud:~ # service apache24 restart
Performing sanity check on apache24 configuration:
AH00526: Syntax error on line 46 of /usr/local/etc/apache24/Includes/MYURL.COM.conf:
SSLCertificateFile takes one argument, SSL Server Certificate file ('/path/to/file' - PEM or DER encoded)

3. Certbot fails with the message below. Port 443 and 80 are open and my URL resolves to my IP.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for
Using the webroot path /usr/local/www/apache24/data/nextcloud for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching Error getting validation data

 - The following errors were reported by the server:

   Domain: MYURL.COM
   Type:   connection
   Detail: Fetching
   Error getting validation data

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.

My Virtualhost file

<VirtualHost *:80>
DocumentRoot "/usr/local/www/apache24/data/nextcloud"
ServerName MYURL.COM
RewriteEngine on
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
#ErrorLog ${APACHE_LOG_DIR}/error.log
#CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /usr/local/www/apache24/data/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
SetEnv HOME /usr/local/www/apache24/data/nextcloud
SetEnv HTTP_HOME /usr/local/www/apache24/data/nextcloud
Satisfy Any

<VirtualHost *:443>
  ServerAdmin Me@MYURL.COM
  ServerName MYURL.COM
  DirectoryIndex index.php
  DocumentRoot /usr/local/www/apache24/data/nextcloud
  SSLCertificateFile /usr/local/etc/letsencrypt/live/MYURL.COM/fullchain.pem
  SSLCertificateKeyFile /usr/local/etc/letsencrypt/live/MYURL.COM/privkey.pem
  SSLEngine on
  # Intermediate configuration, tweak to your needs
  SSLProtocol  all -SSLv2 -SSLv3
  SSLHonorCipherOrder  on
  SSLCompression  off
  SSLOptions +StrictRequire
  <Directory /usr/local/www/apache24/data/nextcloud>
  AllowOverride all
  <IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"


Feb 4, 2018
You are redirecting http to https. From your logs:
"Failed authorization procedure. (http-01)"
Certbot will use http to do its test NOT HTTPS. So basically remove your https config till you get your cert or remove the redirect to https till you get the cert.
Problem 2 says that your cert file in your config is missing. (Obviously cause you have not got the certs yet), so remove the lines in your config that point to the cert file. Or just remove https part entirely till you get the cert.
Not open for further replies.