You probably need to include the www in the single cert.
Or if they are in two separate vhost configs, then get a second cert for the www site.
If A, then just change your certbot request to include www: certbot --apache -d mysite.com -d www.mysite.com
[or --nginx or --standalone or whichever way you got the first cert - just add the www fqdn to it]
If B, then repeat the same certbot request but this time add “www.” to the fqdn used.
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. https://crt.sh/?q=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:
I ran this command:
It produced this output:
My web server is (include version):
The operating system my web server runs on is (include version):
My hosting provider, if applicable, is:
I can login to a root shell on my machine (yes or no, or I don’t know):
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):
I want to keep my website name confidential.
I’m not getting error messages. It’s just leading to http instead of https (as I explained in the original post).
add vhost with 301 redirect to https version on port 80 of your server
for nginx(because I use it)
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location ^~ /.well-known/acme-challenge/ {
default_type “text/plain”;
root /var/www/challenge;
}
location / {
return 301 https://$host$request_uri;
}
}
If you use --apache or --nginx, Certbot will prompt you to add the kind of redirection that @orangepizza mentioned; otherwise, you’ll need to edit your web server configuration file to add an appropriate redirection directive.
But you are trying to get an LE cert.
LE tries to validate your site via port 80.
Your port 80 vhost redirects everything to port 443.
So then LE follows that redirection to port 443
and the LE validation request to port 443 goes unanswered.
[failed validation = no new cert]
This step is premature:
[it sends all http requests to https]
You can temporarily remove those lines or include an exception to the redirection specifically only for the validation requests:
[as suggested by @orangepizza]
[but that code is for nginx - not sure what you are running - it may also work in Apache...]
Or try using this redirection instead:
RewriteEngine On
RewriteRule ^\.well-known\/acme-challenge\/ - [L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
certbot will handle the creation/deletion of the directories.
No; Those are the actual folder names used in authentication requests.
I don't understand the question.
I asked you to delete four lines of code OR insert a location block.
and then also suggested to replace your redirection section with a more appropriate redirection section.
so they’re not directories on the drive?
Also, I tried the code you put up and it still doesn’t work for me.
Here is what my conf looks like now:
<VirtualHost :80>
ServerAdmin webmaster@localhost
ServerName site.com
ServerAlias www.site.com
DocumentRoot /var/www/html/phpbb
ErrorLog {APACHE_LOG_DIR}/error-mr.log
CustomLog {APACHE_LOG_DIR}/access-mr.log combined
RewriteEngine On
RewriteRule ^.well-known/acme-challenge/ - [L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.) https://%{SERVER_NAME}/$1 [R,L]