Uploading docker files

This commit is contained in:
2025-08-09 09:24:29 +02:00
commit b8ef06265c
19 changed files with 796 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
Add to trusted
1. Open console on container
2. php /var/www/html/occ config:system:set trusted_domains 1 --value=kalender.reijnst.se
where value = the domain that is trusted
Step 1: Set trusted_domains with occ Command
First, you need to make sure your trusted domain is set correctly in Nextcloud:
Run this command to set the trusted domain:
bash
Copy
Edit
php /var/www/html/occ config:system:set trusted_domains 1 --value=kalender.reijnst.se
Replace kalender.reijnst.se with your actual Nextcloud domain.
If you have multiple domains, you can set them incrementally (trusted_domains 2, trusted_domains 3, etc.).
Step 2: Set trusted_proxies with occ Command
Next, you'll set the trusted proxy (the IP address of your reverse proxy — in this case, Caddy):
bash
Copy
Edit
php /var/www/html/occ config:system:set trusted_proxies 1 --value=172.18.0.2
Replace 127.0.0.1 with the IP address of your reverse proxy (if it's not on the same machine as Nextcloud). For example, if your Caddy is running remotely, use the Caddy server's IP.
Step 3: Set Forwarded Headers with occ Command
You also need to tell Nextcloud to accept the forwarded headers. Run:
bash
Copy
Edit
php /var/www/html/occ config:system:set forwarded_for_headers 1 --value=HTTP_X_FORWARDED_FOR
php /var/www/html/occ config:system:set forwarded_for_headers 2 --value=HTTP_X_REAL_IP
This will set the headers that Nextcloud will look for to get the real client IP (when behind a proxy).
Step 4: Verify and Restart
After running the commands:
Check your Nextcloud setup by visiting the URL in a browser.
If everything is configured correctly, the "reverse proxy header configuration" error should be gone.
Restart your Nextcloud (or web server) to ensure the changes are applied.
php /var/www/html/occ config:system:set overwrite.cli.url --value="https://kalender.reijnst.se"
php /var/www/html/occ config:system:set overwriteprotocol --value="https"

View File

@@ -0,0 +1,40 @@
version: '3.8'
services:
nextcloud:
image: nextcloud:latest
container_name: nextcloud
ports:
- "8080:80"
environment:
MYSQL_PASSWORD: secret
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_HOST: db
TRUSTED_DOMAINS: reijnst.asuscomm.com, reijnst.asuscomm.com:9900
volumes:
- nextcloud_data:/var/www/html
depends_on:
- db
restart: unless-stopped
db:
image: mysql:5.7
container_name: nextcloud_db
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: secret
volumes:
- nextcloud_db_data:/var/lib/mysql
restart: unless-stopped
redis:
image: redis:latest
container_name: redis
restart: unless-stopped
volumes:
nextcloud_data:
nextcloud_db_data:

View File

@@ -0,0 +1,68 @@
# Define your Docker Compose directory
$composeDir = "C:\Users\johnn\Desktop\Docker\Nextcloud"
# Create the directory if it does not exist
if (-not (Test-Path $composeDir)) {
New-Item -ItemType Directory -Path $composeDir
}
# Change to the target directory
Set-Location -Path $composeDir
# Create a docker-compose.yml file for Nextcloud
$dockerComposeContent = @"
version: '3.8'
services:
nextcloud:
image: nextcloud:latest
container_name: nextcloud
ports:
- "8080:80"
environment:
MYSQL_PASSWORD: secret
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_HOST: db
volumes:
- nextcloud_data:/var/www/html
depends_on:
- db
restart: unless-stopped
db:
image: mysql:5.7
container_name: nextcloud_db
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: secret
volumes:
- nextcloud_db_data:/var/lib/mysql
restart: unless-stopped
redis:
image: redis:latest
container_name: redis
restart: unless-stopped
volumes:
nextcloud_data:
nextcloud_db_data:
"@
# Write docker-compose.yml to the directory
$dockerComposeContent | Out-File -FilePath "$composeDir\docker-compose.yml" -Force
# Pull the Docker images and start the containers
Write-Host "Running docker-compose up..."
docker-compose -f "$composeDir\docker-compose.yml" up -d
# Wait for Nextcloud to fully initialize
Write-Host "Waiting for Nextcloud to initialize..."
Start-Sleep -Seconds 30
# Accessing Nextcloud to install Appointments app manually
Write-Host "Nextcloud setup completed. Access it at http://localhost:8080"
Write-Host "Please log in and install the Appointments app from the Nextcloud app store."