An unexpected error occurred: StopIteration Ubuntu 18.01 Apache2


My domain is:

I ran this command: sudo certbot --apache -d

It produced this output: An unexpected error occurred: StopIteration
Please see the logfiles in /var/log/letsencrypt for more details.

2019-01-04 18:45:08,582:DEBUG:certbot.error_handler:Calling registered functions
2019-01-04 18:45:08,583:DEBUG:certbot.reporter:Reporting to user: Unable to install the certificate
2019-01-04 18:45:08,583:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
File “/usr/bin/certbot”, line 11, in
load_entry_point(‘certbot==0.28.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python3/dist-packages/certbot/”, line 1340, in main
return config.func(config, plugins)
File “/usr/lib/python3/dist-packages/certbot/”, line 1101, in run
_install_cert(config, le_client, domains, new_lineage)
File “/usr/lib/python3/dist-packages/certbot/”, line 735, in _install_cert
path_provider.cert_path, path_provider.chain_path, path_provider.fullchain_path)
File “/usr/lib/python3/dist-packages/certbot/”, line 498, in deploy_certificate
File “/usr/lib/python3/dist-packages/certbot_apache/”, line 334, in deploy_cert
vhosts = self.choose_vhosts(domain)
File “/usr/lib/python3/dist-packages/certbot_apache/”, line 358, in choose_vhosts
return [self.choose_vhost(domain, create_if_no_ssl)]
File “/usr/lib/python3/dist-packages/certbot_apache/”, line 540, in choose_vhost
vhost = self.make_vhost_ssl(vhost)
File “/usr/lib/python3/dist-packages/certbot_apache/”, line 1115, in make_vhost_ssl
self._copy_create_ssl_vhost_skeleton(nonssl_vhost, ssl_fp)
File “/usr/lib/python3/dist-packages/certbot_apache/”, line 1259, in _copy_create_ssl_vhost_skeleton
ssl_vh_contents, sift = self._sift_rewrite_rules(orig_contents)
File “/usr/lib/python3/dist-packages/certbot_apache/”, line 1331, in _sift_rewrite_rules
line = next(contents)
2019-01-04 18:45:08,584:ERROR:certbot.log:An unexpected error occurred:

My web server is (include version): Apache2

The operating system my web server runs on is (include version): Ubuntu 18.04

My hosting provider, if applicable, is: NA

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

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): No


Certbot seems to be having trouble parsing your Apache configuration.

Do you have a RewriteCond directive without any corresponding RewriteRules? If so, try commenting it out or removing it.

closed #3

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