Page 1 of 1

Trouble enabling Https:// with Let's Encrypt on lighttpd

Posted: Tue Jun 02, 2020 7:35 pm
by chucklesmcgee
Apologies in advance for being stupid. Very inexperienced here.

I have lighttpd running with a no-ip address on http just fine (RPi4).

I ran dietpi-letsencrypt, punched in my domain info and such and got a success.

I edited my lightpttd .conf file to include

Code: Select all

$HTTP["host"] =~ ".*" {
        url.redirect = (".*" => "https://%0$0")
Then rebooted.

Still no change in https. Surely I'm missing some obvious step.

Re: Trouble enabling Https:// with Let's Encrypt on lighttpd

Posted: Tue Jun 02, 2020 8:32 pm
by Joulinar
Hi,

many thanks for your request. Basically it's not needed to adjust any files if you use DietPi scripts to setup SSL/HTTPS. All steps are automatically done. Below a small step by step guide how to enable SSL using dietpi-letsencrypt
  1. create a clean DietPi installation and complete initial setup
  2. first you would need to have a DynDNS service that allow you to connect from outside world to your home network by using a dynamic domain name. If you already have a DDNS service, you can go to point 5
  3. to get a DDNS domain, you would need to register at https://www.noip.com/ first
  4. if you finished registration process, we can go to install No-IP software on your DietPi device
    • run dietpi-config
    • go to option 8 : Network Options: Misc
    • select No-IP
    • confirm installation
    • once installation of No-IP software is done, select No-IP again
    • enter your login credentials for No-IP
  5. if DDNS is working, continue with next step
  6. ensure Port 80 and 443 are forwarded (from your internet router) correctly to your DietPi device
  7. once ready, run dietpi-software, search and install NextCloud
  8. once installation completed and your system was rebooted, try to connect to your Webserver on http (port 80)
  9. pls try to connect from your LAN as well as from Internet, you should receive the Webserver Default Page
    • once you're able to connect to your Webserver from Internet on http (80), got to point 10. (https - port 443 will not work at this stage)
    • if you are not able to connect on http (80) from internet, you would need to check why and what's wrong with your port forwarding
  10. let's do the SSL certificate now, run dietpi-letsencrypt
  11. install CertBot
  12. once done you will be ask for your Let'sEncrypt information
    • fill in your domain name (No-IP DDNS)
    • fill in your email address
    • set Redirect to ON
    • Apply the setting
  13. once finished (and all services started) you should be able to reach your website on http (80) as well as https (443)
  14. if you are opening the website on http (80) you should be automatically redirected to https (443)

Re: Trouble enabling Https:// with Let's Encrypt on lighttpd

Posted: Tue Jun 02, 2020 10:47 pm
by chucklesmcgee
Thanks for that.

I've setup owncloud, is that ok?

I now can't access the http page at all, even using the IP, previously could access on both the local network and the dynamic URL.

I think I'm missing something really basic.

Re: Trouble enabling Https:// with Let's Encrypt on lighttpd

Posted: Wed Jun 03, 2020 12:24 am
by Joulinar
yes owncloud is fine. I used NextCloud as example an my small how-to. basically you should revert all manual changes you did.

Re: Trouble enabling Https:// with Let's Encrypt on lighttpd

Posted: Wed Jun 03, 2020 3:36 am
by chucklesmcgee
Well, that worked. I was hesitant to do a clean install what with other services configured but it was far faster in the end than I had thought. Thanks!

Re: Trouble enabling Https:// with Let's Encrypt on lighttpd

Posted: Wed Jun 03, 2020 10:56 am
by Joulinar
yap indeed. sometimes it much faster starting from scratch to get a clean installation.

Re: Trouble enabling Https:// with Let's Encrypt on lighttpd

Posted: Wed Jul 22, 2020 9:39 am
by Deleted User 7758
Thanks for the walk-through @Joulinar
Quick question 1: Can port-forwarding for port 80 be turned off now that everything is being redirected to 443?
Quick question 2: Is there any security advantage to chasing the port of https to something else? (security through obscurity I know but is it a worthwhile step?)

Re: Trouble enabling Https:// with Let's Encrypt on lighttpd

Posted: Wed Jul 22, 2020 10:51 am
by Joulinar
I guess you would need to keep port 80 and 443 open, otherwise letsencrypt will not be able to renew certificates if needed. But it should not be a problem if you activated automatic redirection of HTTP to HTTPS (step 12). As well I don't think it's needed to move port 443 to something else.

Re: Trouble enabling Https:// with Let's Encrypt on lighttpd

Posted: Thu Jul 23, 2020 8:59 am
by Deleted User 7758
Thank you!