"unable to find vhost" error on Ubuntu 16.04 + Apache, www and non-www


#1

Hi all, this is my first time installing a Let’s Encrypt SSL cert and I’ve hit a snag. I’m installing on a Wordpress site by following this DigitalOcean guide. I’ve gotten to step 2 and have run into my issue.

I am trying to install a single cert for both the “example.com” and “www.example.com” domains. However, I’ve been hit with this message. I don’t know where to go from here and am in need of assistance. Thanks! :relaxed:


My domain is: (prefer not to disclose)

I ran this command: sudo letsencrypt --apache -d example.com -d www.example.com

It produced this output: IMAGE HERE
We were unable to find a vhost with a ServerName or Address of
www.example.com.
Which virtual host would you like to choose?

x1 000-default.conf | |
x2 default-ssl.conf | | HTTPS
x3 000-default-le-ssl.conf | example.com | HTTPS

My operating system is (include version): Ubuntu 16.04 LTS

My web server is (include version): Apache2 running Wordpress

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

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


#2

Can you paste your config files at pastebin.com ? I’m guessing that www.example.com isn’t set up there correctly.


#3

Sorry to have to ask, but where from and how do I export my config files?


#4

The main apache config files for your sites are usually in /etc/apache2/sites-available. Exactly how you copy and paste them depends on what OS you are running on. It’s probably easier to copy them to your local machine *by the same method you’d normally copy files between your local machine and the server ), then open them up in a plain text editor, so you can copy and paste them via your browser into pastebin.com.


#5

Thanks serverco, here’s the two .conf files from “/etc/apache2/sites-available”.

http://pastebin.com/tuAmje39


#6

You don’t have the domain name defined within the configs.

There are 2 options.

  1. You could use the “webroot” option, rather than “apache” - which will mean you can obtain the cert, however letsencrypt will not edit your config and add the cert definitions in there manually.

  2. You need to define the server name and server alias

ServerName example.com
ServerAlias www.example.com

into your config.


#7

Perfect, it worked great. Thanks serverco!


#8

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