Directory/file not being created

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: Keith Miller

I ran this command: certbot -a webroot -i nginx --webroot-path /var/www/certbot -d justourmail.com

It produced this output: /var/www/certbot does not exist or is not a directory

My web server is (include version): nginx/1.24.0 (Ubuntu)

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

My hosting provider, if applicable, is: Self

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

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 2.9.

The --webroot-path should match the root directory you name in your nginx server block for that domain.

For example, it would be /var/www/certbot if your server block looked like below. And, you would need to create that directory with suitable permissions so nginx can read from it.

server {
    listen 80;
    listen [::]:80;     # if using IPv6
    server_name example.com www.example.com;
    root /var/www/html;

    location /.well-known/acme-challenge/ {
        root /var/www/certbot;       # make/use folder as you prefer
    }
    location / {
       return 301 https://$host$request_uri;
    }
}
5 Likes