How can i enable SSL/HTTPS on my NexCloud setup on DietPi?

I’ve installed NexCloud via dietpi-software. Now I have everything up and running but I don’t have SSL enabled. How can I setup SSL so that i can access my RPI with Nexcloud via HTTPS?

There are some tutorials out there but I know that DietPi has the dietpi-letsencrypt + certbot built-in so if it offers an easier method to do this i prefer doing the “dietpi way”.


Note: Currently my setup is only for access within my home network but in the future i plan to implement access from the outside, so an SSL implementation that allows me later to easily implement external access would be better.

Hi,

many thanks for your report. I already create a small how-to. I will copy it below. It contains an end-to-end description. Maybe some parts are not applicable for you.

  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

Since my RPI IP is not publicly accessible due to the fact that i want local access only, i only need to start from step 10 right?


In the step 12. you said to “fill in your domain name (No-IP DDNS) in Let’sEncrypt information” but i don’t have any because i think i don’t need DDNS service for local access only. Can this be a problem?

Note: In another forum, other user told me to do this (only referring this with the hope that this might help someway):

“sudo certbot —apache” is the command to install a certificate, then confirm you have the site enabled (“a2ensite xxxxx-le-ssl.conf”) replace “x’s” with whatever comes before “le-ssl.conf” in “/etc/apache2/sites-available/”. On the Nextcloud side of things everything should work fine, but if you see any problems they will most likely be fixed by checking the virtual host file for issues.

SSL doesn’t make sense for local use without internet. Next to that you need to have internet connection on port 80 + 443 from WAN to your device, otherwise you will not be able to crate an official certificate using Let’sEncrypt. Because Let’sEncrypt will verify your domain before signing an official certificate for you.

Thanks Joulinar

After several days of trying to get SSL working, your solution worked first time! Thank you so much

The solution works.

Thanks Joulinar!

Hi,

I managed to access the lighttp welcome page from both my LAN and from my mobile phone via 4G.

But after finishing the dietpi-letsencrypt installation and issuing

service lighttpd force-reload

I have tried to access the same welcome page, but when I try to access it via https, still says ‘Not secure’ as can be seen in the link below.

https://ibb.co/vxFmkCv

Thoughts?

Well the certificate was issued for a specific domain and you would need to access the side with exactly that domain. Looking to you picture shows you are using an IP address. For sure the certificate is not valid in this case.

Thanks! It appears that one of my port forwarding definitions was not saved in the ISP box. It is working fine now!

BTW, Joulinar, great job on the how-to! May I suggest making a permanent post of it?

It’s part of a community tutorial already :slight_smile:

https://dietpi.com/forum/t/how-can-i-secure-connection-to-nextcloud/3820/1

For anyone setting up ownCloud on DietPi, you may like to know that the how-to on setting up HTTPS described above works just as well with an ownCloud installation as with Nextcloud - thanks Joulinar!

I’m new to Dietpi, and like so many others I’m impressed.

Of course, it’s not always quite as simple to get everything right first time as some people would like to think, but that’s why a forum like this is needed. The quality of the replies from the Dietpi team is terrific, and I’ve ended up finding in these pages the answers to many of the jams I’ve got into (sometimes after long struggles with various less than adequate online tutorials and videos).

Thanks everyone!

thx for sharing. Usually the guide should be working for every app using a web server stack.

Just one think to mention: DDNS part is not up-to-date anymore. In meantime DietPi is supporting more DDNS services. There is no strickt need to use No-IP anymore.

Ah, thanks Joulinar. I used No-IP and got DDNS to work in my test set-up, but it would be good to use the new approach. Is there an up-to-date tutorial/how-to for this?

nope, there is no up-to-date guide. But it should not matter that much. Point 3 and 4 are slightly different now.

point 3 depends on your DDNS provider
and point 4 has been replaced by our new tool dietpi-ddns

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.