I tried to run DietPi-LetsEncrypt with both example.com and http://www.example.com in the Domain field. I've tried it with a comma, I've tried adding -d between the domains. None of these are working for me.
My solution was to run DietPi-LetsEncrypt twice, once with each domain. Then I duplicated the VirtualHost section in /etc/apache2/sites-available/000-default-le-ssl.conf and took out the 'www' in the second block.
That seemed to work but there must be a better way. Did I miss an early configuration file option?
Can you add the option to user "--test-cert" for testing and setup? I'm sure I'm about to hit the rate limit.
LetsEncrypt domain.com and www.domain.com Topic is solved
Re: LetsEncrypt domain.com and www.domain.com
Hi Thad,
DietPi-LetsEncrypt is just a frontend for Let Encrypt Auto with a few additions to work with DietPi (eg: cron). Also, if the ServerName does not exist in /etc/apache2/sites-available/000-default.conf , DietPi will add the url you're using in the menu once only. It may be worth checking that file to ensure the ServerName is matching the same value you're using in the menu.
When you select the menu to create the cert, the following is run:We did have another user report issues with non www. urls, but I'am unable to replicate it on my network. I simply use the example.com and it works 1st time.
Wish I could help more, but I cant seem to break it. LetsEncrypt with or without www. works everytime on my network.
DietPi-LetsEncrypt is just a frontend for Let Encrypt Auto with a few additions to work with DietPi (eg: cron). Also, if the ServerName does not exist in /etc/apache2/sites-available/000-default.conf , DietPi will add the url you're using in the menu once only. It may be worth checking that file to ensure the ServerName is matching the same value you're using in the menu.
When you select the menu to create the cert, the following is run:
Code: Select all
./letsencrypt-auto --duplicate --agree-tos $cli_redirect --rsa-key-size $LETSENCRYPT_KEYSIZE --email $LETSENCRYPT_EMAIL -d $LETSENCRYPT_DOMAIN
Wish I could help more, but I cant seem to break it. LetsEncrypt with or without www. works everytime on my network.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: LetsEncrypt domain.com and www.domain.com
Fourdee, thanks for pointing me in the right direction.
I made of copy of VirtualHost for both domain.com and http://www.domain.com.
And then successfully ran letsencrypt-auto.
Both domains are now happily https and test well on https://www.ssllabs.com/ssltest/index.html.
Will I need to setup a cron job manually for renewal?
I made of copy of VirtualHost for both domain.com and http://www.domain.com.
Code: Select all
#/etc/apache2/sites-available/000-default.conf
UseCanonicalName Off
<VirtualHost *:80>
ServerAdmin user@domain.com
ServerName domain.com
DocumentRoot /var/www
ErrorLog /error.log
#CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,QSA,R=permanent]
</VirtualHost>
<VirtualHost *:80>
ServerAdmin user@domain.com
ServerName www.domain.com
DocumentRoot /var/www
ErrorLog /error.log
#CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,QSA,R=permanent]
</VirtualHost>
Code: Select all
/etc/letsencrypt_scripts/letsencrypt-auto --duplicate --agree-tos $cli_redirect --rsa-key-size 2048 --email user@domain.com -d domain.com -d www.domain.com
Will I need to setup a cron job manually for renewal?
Re: LetsEncrypt domain.com and www.domain.com
Hi Thad,thad wrote:Fourdee, thanks for pointing me in the right direction.
I made of copy of VirtualHost for both domain.com and http://www.domain.com.
And then successfully ran letsencrypt-auto.Code: Select all
#/etc/apache2/sites-available/000-default.conf UseCanonicalName Off <VirtualHost *:80> ServerAdmin user@domain.com ServerName domain.com DocumentRoot /var/www ErrorLog /error.log #CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine on RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,QSA,R=permanent] </VirtualHost> <VirtualHost *:80> ServerAdmin user@domain.com ServerName www.domain.com DocumentRoot /var/www ErrorLog /error.log #CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine on RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,QSA,R=permanent] </VirtualHost>
Both domains are now happily https and test well on https://www.ssllabs.com/ssltest/index.html.Code: Select all
/etc/letsencrypt_scripts/letsencrypt-auto --duplicate --agree-tos $cli_redirect --rsa-key-size 2048 --email user@domain.com -d domain.com -d www.domain.com
Will I need to setup a cron job manually for renewal?
As this setup is unique, the cron job created in dietpi-letsencrypt only works on 1 domain name. I can create a script for you that will run both domains as a cron.monthly if you need it.
Before I do that, i need to ask (just to be sure)

If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Re: LetsEncrypt domain.com and www.domain.com
<whisper>Actually domain.com isn't my real domain name.</whisper>
Re: LetsEncrypt domain.com and www.domain.com
thad wrote:<whisper>Actually domain.com isn't my real domain name.</whisper>

Cron monthly job (change details as needed):
Code: Select all
cat << _EOF_ > /etc/cron.monthly/dietpi-letsencrypt
#!/bin/bash
{
#////////////////////////////////////
# DietPi-LetsEncrypt Autorenew script
#////////////////////////////////////
#----------------------------------------------------------------
# Main Loop
#----------------------------------------------------------------
/etc/letsencrypt_scripts/letsencrypt-auto --duplicate --agree-tos --no-redirect --rsa-key-size 2048 --email user@domain.com -d domain.com -d www.domain.com
#----------------------------------------------------------------
exit
#----------------------------------------------------------------
}
_EOF_
chmod +x /etc/cron.monthly/dietpi-letsencrypt
Code: Select all
/etc/cron.monthly/dietpi-letsencrypt
Code: Select all
dietpi-cron
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Donating is the easiest – you can use PayPal or become a DietPi patron.