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

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

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

Then rebooted.

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

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
  1. if DDNS is working, continue with next step
  2. ensure Port 80 and 443 are forwarded (from your internet router) correctly to your DietPi device
  3. once ready, run dietpi-software, search and install NextCloud
  4. once installation completed and your system was rebooted, try to connect to your Webserver on http (port 80)
  5. 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
  1. let’s do the SSL certificate now, run dietpi-letsencrypt
  2. install CertBot
  3. 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
  1. once finished (and all services started) you should be able to reach your website on http (80) as well as https (443)
  2. if you are opening the website on http (80) you should be automatically redirected to https (443)
1 Like

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.

yes owncloud is fine. I used NextCloud as example an my small how-to. basically you should revert all manual changes you did.

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!

yap indeed. sometimes it much faster starting from scratch to get a clean installation.

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

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.

Thank you!