Skip to content

Instantly share code, notes, and snippets.

@mohamed-ea
Created September 11, 2023 08:45
Show Gist options
  • Save mohamed-ea/dde6263fcd95eb18f793ce663b942d1a to your computer and use it in GitHub Desktop.
Save mohamed-ea/dde6263fcd95eb18f793ce663b942d1a to your computer and use it in GitHub Desktop.
HomeLab: NextCloud with ISPConfig
# Nginx:
server {
if ($host = mcloud.MY-HOMELAB.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name mcloud.MY-HOMELAB.com;
}
server {
# listen *:80;
# listen [::]:80;
listen *:443 ssl http2;
ssl_protocols TLSv1.3 TLSv1.2;
listen [::]:443 ssl http2;
ssl_certificate /var/www/clients/client1/web13/web/public/ssl/mcloud.MY-HOMELAB.com-le.crt;
ssl_certificate_key /var/www/clients/client1/web13/web/public/ssl/mcloud.MY-HOMELAB.com-le.key;
server_name mcloud.MY-HOMELAB.com ;
root /var/www/mcloud.MY-HOMELAB.com/web/;
disable_symlinks if_not_owner from=$document_root;
location ^~ /.well-known/acme-challenge/ {
access_log off;
log_not_found off;
root /usr/local/ispconfig/interface/acme/;
autoindex off;
index index.html;
try_files $uri $uri/ =404;
}
location / {
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 64;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:9090/;
}
}
# Docker Compose:
version: '2'
volumes:
nextcloud:
db:
services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- ./nc-db:/var/lib/mysql
#ports:
#- 9336:3306
environment:
- MYSQL_ROOT_PASSWORD=CHANGE-ME!
- MYSQL_PASSWORD=CHANGE-ME!
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
app:
image: nextcloud
restart: always
ports:
- 9090:80
links:
- db
volumes:
- ./nc-data:/var/www/html
environment:
- MYSQL_PASSWORD=CHANGE-ME!
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
- OVERWRITECLIURL=https://mcloud.MY-HOMELAB.com
- OVERWRITEHOST=mcloud.MY-HOMELAB.com
- OVERWRITEPROTOCOL=https
# Nextcloud Config:
<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'instanceid' => 'ocydgxwe2o8p',
'passwordsalt' => 'sG0bF3+h+AG8YDxoPbrML2u8Ss9BXA',
'secret' => 'Te796VD5ORiTpM9pLU6vGBIt2pzfqVa9wm/xA9BMlYcpPbi7',
'trusted_domains' =>
array (
0 => 'mcloud.MY-HOMELAB.com',
1 => 'localhost:9090',
),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'mysql',
'version' => '27.0.2.1',
'overwrite.cli.url' => 'https://mcloud.MY-HOMELAB.com',
'overwritehost' => 'mcloud.MY-HOMELAB.com',
'overwriteprotocol' => 'https',
'dbname' => 'nextcloud',
'dbhost' => 'db',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => 'CHANGE-ME!',
'installed' => true,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment