Homelab Infrastructure β PhotoPrism
π£ Host VM: Nextcloud (VMID 105, 192.168.5.141)
π£ Public URL: https://cloud.kalymoon.com
π£ Internal URL: http://192.168.5.141
π£ Last Updated: April 2026
| π£ Property | π£ Value |
|---|---|
| OS | Ubuntu Server 22.04/24.04 |
| Web Server | Apache2 |
| Database | MariaDB |
| PHP Stack | php, php-mysql, php-gd, php-xml, php-mbstring, php-curl, php-zip, php-intl, php-bcmath, php-gmp |
| Nextcloud Root | /var/www/nextcloud |
| Nextcloud Owner | www-data |
| Config File | /var/www/nextcloud/config/config.php |
| Reverse Proxy | Nginx Proxy Manager on Kalymoon (192.168.5.140:81) |
| SSL | Let's Encrypt via NPM |
| π£ Layer | π£ Detail |
|---|---|
| Public entry | https://cloud.kalymoon.com |
| Reverse proxy | Nginx Proxy Manager β http://192.168.5.141 |
| App server | Apache2 + PHP on Nextcloud VM |
| Database | MariaDB β db: nextcloud, user: nextclouduser |
| Storage | /var/www/nextcloud/data + additional mounts at /srv/nextcloud-shares |
| π£ App | π£ URL | π£ Wiki |
|---|---|---|
| Nextcloud | π cloud.kalymoon.com | π this page |
| PhotoPrism | π 192.168.5.141:2342 | π Wiki |
Install the full LAMP stack:
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mariadb-server libapache2-mod-php \
php php-mysql php-gd php-xml php-mbstring php-curl php-zip \
php-intl php-bcmath php-gmp unzip -y
Secure MariaDB and create the database:
sudo mysql_secure_installation
sudo mysql -u root -p
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Download and install Nextcloud:
cd /var/www/
sudo wget https://download.nextcloud.com/server/releases/latest.zip
sudo unzip latest.zip
sudo chown -R www-data:www-data nextcloud
sudo chmod -R 755 nextcloud
Create the site config:
sudo nano /etc/apache2/sites-available/nextcloud.conf
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
Enable the site and required modules:
sudo a2ensite nextcloud.conf
sudo a2enmod rewrite headers env dir mime
sudo systemctl restart apache2
After setup, Nextcloud may block access from your domain or IP. Fix it in the config:
sudo nano /var/www/nextcloud/config/config.php
Add or update the trusted_domains array:
'trusted_domains' =>
array (
0 => '192.168.5.141',
1 => 'cloud.kalymoon.com',
),
π£ This must include both the internal IP and the public domain. Missing entries cause login failures and "untrusted domain" errors even with correct credentials.
π£ Wrong password / login failure
Usually not actually a wrong password. Caused by missing proxy headers, trusted domains not set, or HTTP/HTTPS mismatch. Fix by verifying trusted_domains in config.php and ensuring NPM is passing the correct headers.
π£ Permissions errors on data directory
If Nextcloud can't write files, re-apply ownership:
sudo chown -R www-data:www-data /var/www/nextcloud
sudo chmod -R 755 /var/www/nextcloud
π£ PhotoPrism can't read Nextcloud files
PhotoPrism mounts /var/www/nextcloud/data/kalyssa/files/Image Files directly. If PhotoPrism loses access after a Nextcloud update or permission change, check that www-data still owns the data directory and that the Docker volume mount is intact. See π PhotoPrism wiki for details.
# Restart Apache
sudo systemctl restart apache2
# Check Apache status
sudo systemctl status apache2
# Nextcloud maintenance mode on/off
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
# Run Nextcloud cron manually
sudo -u www-data php /var/www/nextcloud/cron.php
# Check Nextcloud logs
sudo tail -f /var/www/nextcloud/data/nextcloud.log
# MariaDB β connect as root
sudo mysql -u root -p
# Check disk usage
df -h /var/www/nextcloud/data
π£ Tags: nextcloud β’ apache β’ mariadb β’ php β’ cloud-storage β’ self-hosted β’ ssl β’ reverse-proxy