Certbot Multiple subdomains - locations

I am trying for the first time to issue a certificate for a domain and its subdomains on my server.

I am using this command syntax:

sudo certbot certonly --webroot --agree-tos --email myemail@gmail.com -d domain.org -d www.domain.org -w /var/www/domain.org -d mail.domain.org -w /var/www/domain.org.mail -d dev.domain.org -w /var/www/domain.org.dev

however I am getting error: "If you specify multiple webroot paths, one of them must precede all domain flags"

Any help on the correct command would be much appreciated.

2 Likes

Hi @neodjandre

read the documentation:

certbot certonly --webroot -w /var/www/example -d www.example.com -d example.com -w /var/www/other -d other.example.net -d another.other.example.net

A first default -w is required.

2 Likes

many thanks I have figured it out now :slight_smile:

4 Likes

For those that may read this later and wonder what it was that you figured out.
and exactly how did you get it to work...

In your command the domains immediately preceded their matching webroots.
In your solution, I suspect, you reversed that order.
[webroots immediately preceding their matching domains]

2 Likes

yes that's exactly what I did per [JuergenAuer]'s suggestion..

2 Likes