Configure SSL Certificate for Nextcloud on Raspberry pi

Опубликовано: 14 Март 2026
на канале: Fun & Tech
5,461
25

Shows on how to configure a secure certificate on next cloud.
Directory to store the SSL certificate:
---------------------------------------
sudo mkdir -p /etc/apache2/ssl

Generate the certificate:
-------------------------
sudo openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Enable SSL Module for Apache:
----------------------------
sudo a2enmod ssl

Modify the configuration file:
------------------------------
sudo nano /etc/apache2/sites-avilable/default-ssl.conf

Change to
----------------------
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

Enable default SSL and restart apache
--------------------------------------
sudo a2ensite default-ssl.conf
sudo service apache2 restart

Force SSL usage on NextCloud:
----------------------------------------------------
sudo nano /etc/apache2/sites-available/000-default.conf

VirtualHost *:80
ServerAdmin example@example

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
/VirtualHost


sudo a2enmod rewrite
sudo service apache2 restart

https://picloud/nextcloud